diff --git a/README.md b/README.md index f1ca251..db0a248 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,22 @@ -# Manage your Laravel Task Scheduling in a Filament interface and save schedules to the database. +# Manage your Filament Task Scheduling in a Filament interface and save schedules to the database. [![Latest Version on Packagist](https://img.shields.io/packagist/v/husam-tariq/filament-database-schedule.svg?style=flat-square)](https://packagist.org/packages/husam-tariq/filament-database-schedule) -[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/husam-tariq/filament-database-schedule/run-tests?label=tests)](https://github.com/husam-tariq/filament-database-schedule/actions?query=workflow%3Arun-tests+branch%3Amain) -[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/husam-tariq/filament-database-schedule/Check%20&%20fix%20styling?label=code%20style)](https://github.com/husam-tariq/filament-database-schedule/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/husam-tariq/filament-database-schedule.svg?style=flat-square)](https://packagist.org/packages/husam-tariq/filament-database-schedule) -This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. +![Filament Database Schedule](img/main.png) + +# Documentation + +This librarian creates a filament resource(default: /schedule) in your filament admin panel where it is possible to manage which +schedules will be executed at any given moment, these schedules are recorded in the database and can be changed, +activated, inactivated or deleted via your panel without the need for a new application deployment. + +## Create Schedules +![Create Schedules](img/schedules_create.png) +## Show History Schedules +![Show History Schedules](img/history.png) ## Installation @@ -17,7 +26,7 @@ You can install the package via composer: composer require husam-tariq/filament-database-schedule ``` -You can publish and run the migrations with: +You should publish and run the migrations with: ```bash php artisan vendor:publish --tag="filament-database-schedule-migrations" @@ -30,30 +39,10 @@ You can publish the config file with: php artisan vendor:publish --tag="filament-database-schedule-config" ``` -Optionally, you can publish the views using - -```bash -php artisan vendor:publish --tag="filament-database-schedule-views" -``` - -This is the contents of the published config file: - -```php -return [ -]; -``` - -## Usage - -```php -$filament-database-schedule = new HusamTariq\FilamentDatabaseSchedule(); -echo $filament-database-schedule->echoPhrase('Hello, HusamTariq!'); -``` - -## Testing +You can publish the translations files with: ```bash -composer test +php artisan vendor:publish --tag="filament-database-schedule-translations" ``` ## Changelog diff --git a/img/history.png b/img/history.png new file mode 100644 index 0000000..3247391 Binary files /dev/null and b/img/history.png differ diff --git a/img/main.png b/img/main.png new file mode 100644 index 0000000..3a49940 Binary files /dev/null and b/img/main.png differ diff --git a/img/schedules_create.png b/img/schedules_create.png new file mode 100644 index 0000000..1586d26 Binary files /dev/null and b/img/schedules_create.png differ diff --git a/src/Filament/Resources/ScheduleResource/Pages/CreateSchedule.php b/src/Filament/Resources/ScheduleResource/Pages/CreateSchedule.php index 1e1db2a..f3cf911 100644 --- a/src/Filament/Resources/ScheduleResource/Pages/CreateSchedule.php +++ b/src/Filament/Resources/ScheduleResource/Pages/CreateSchedule.php @@ -35,6 +35,12 @@ protected function getForms(): array ->inlineLabel(false), ]; } + + protected function getRedirectUrl(): string + { + return $this->getResource()::getUrl('index'); + } + protected function getFormSchema(): array { return [ diff --git a/src/Filament/Resources/ScheduleResource/Pages/EditSchedule.php b/src/Filament/Resources/ScheduleResource/Pages/EditSchedule.php index b8c034e..f78b194 100644 --- a/src/Filament/Resources/ScheduleResource/Pages/EditSchedule.php +++ b/src/Filament/Resources/ScheduleResource/Pages/EditSchedule.php @@ -22,6 +22,11 @@ protected function getActions(): array ]; } + protected function getRedirectUrl(): string + { + return $this->getResource()::getUrl('index'); + } + public $commands; public function mount($record): void @@ -30,6 +35,19 @@ public function mount($record): void parent::mount($record); } + protected function getForms(): array + { + return [ + 'form' => $this->makeForm() + ->context('edit') + ->model($this->getRecord()) + ->schema($this->getFormSchema()) + // ->columns(2) + ->statePath('data') + ->inlineLabel(false), + ]; + } + protected function getFormSchema(): array { return [ @@ -104,10 +122,6 @@ protected function getFormSchema(): array ]; } - protected function mutateFormDataBeforeSave(array $data): array - { - $data['params'] = $this->fixParams($data['params']); - return $data; - } + } diff --git a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php index 2760644..1ec062b 100644 --- a/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php +++ b/src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php @@ -75,17 +75,9 @@ protected function getTableColumns(): array ]; } - protected function isTablePaginationEnabled(): bool + /* protected function isTablePaginationEnabled(): bool { return false; - } - /* protected function getForms(): array - { - return [ - 'form' => $this->makeForm() - ->context('view') - ->disabled() - , - ]; } */ + }