Use this if you need to:
- ✅ Stop and start scheduled commands without redeploying.
- ✅ Execute commands without going into server console.
- ✅ Keep the visibility, control, and reviewability of the schedule configurations in your codebase.
-
Install the package
composer require acdphp/laravel-schedule-police
-
Run the migration.
php artisan migrate
-
Publish assets
php artisan vendor:publish --tag=schedule-police-assets --force
-
Update your Console Kernel to extend
Acdphp\SchedulePolice\Console\Kernel
instead ofIlluminate\Foundation\Console\Kernel
.namespace App\Console; use Acdphp\SchedulePolice\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel ...
You may override the config by publishing it.
php artisan vendor:publish --tag=schedule-police-config
You may also just define environment variables if you don't need to publish the config.
- Disable command execution in the dashboard.
SCHEDULE_POLICE_ALLOW_EXECUTE_CMD=false
- Add prefix to routes.
SCHEDULE_POLICE_URL_PREFIX=your-prefix
After installation, you may access the dashboard via the /schedule-police
route.
By default, you will only be able to access this dashboard in the local environment. However, you may specify authorization for non-local environments by defining viewSchedulePolice
gate, typically within the boot
method of the App\Providers\AuthServiceProvider
class.
public function boot(): void
{
Gate::define('viewSchedulePolice', function (User $user) {
// return true or false
});
}
The MIT License (MIT). Please see License File for more information.