Skip to content

Commit

Permalink
v1
Browse files Browse the repository at this point in the history
  • Loading branch information
husam-tariq committed Mar 12, 2023
1 parent 0dc4c12 commit f182a81
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 42 deletions.
43 changes: 16 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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"
Expand All @@ -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
Expand Down
Binary file added img/history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/schedules_create.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ protected function getForms(): array
->inlineLabel(false),
];
}

protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('index');
}

protected function getFormSchema(): array
{
return [
Expand Down
24 changes: 19 additions & 5 deletions src/Filament/Resources/ScheduleResource/Pages/EditSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ protected function getActions(): array
];
}

protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('index');
}

public $commands;

public function mount($record): void
Expand All @@ -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 [
Expand Down Expand Up @@ -104,10 +122,6 @@ protected function getFormSchema(): array
];
}

protected function mutateFormDataBeforeSave(array $data): array
{
$data['params'] = $this->fixParams($data['params']);
return $data;
}


}
12 changes: 2 additions & 10 deletions src/Filament/Resources/ScheduleResource/Pages/ViewSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
,
];
} */

}

0 comments on commit f182a81

Please sign in to comment.