Skip to content

Commit

Permalink
Update README.md to Laravel 11 Prune (#213)
Browse files Browse the repository at this point in the history
Laravel 11 has no Kernel file in the app anymore, the Schedule for the Prunable should be set in the routes/console.php
  • Loading branch information
arnebr authored May 13, 2024
1 parent 83b457c commit a21e227
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,27 +343,19 @@ return [
```

After configuring the model, you should schedule the `model:prune` Artisan command in your
application's `Kernel` class. Don't forget to explicitly mention the `WebhookCall` class.
application's `route/console.php`. Don't forget to explicitly mention the `WebhookCall` class.
You are free to choose the appropriate interval at which this command should be run:

```php
namespace App\Console;

use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Facades\Schedule;
use Spatie\WebhookClient\Models\WebhookCall;

class Kernel extends ConsoleKernel
{
protected function schedule(Schedule $schedule)
{
$schedule->command('model:prune', [
'--model' => [WebhookCall::class],
])->daily();

// This will not work, as models in a package are not used by default
// $schedule->command('model:prune')->daily();
}
}
Schedule::command('model:prune', [
'--model' => [WebhookCall::class],
])->daily();

// This will not work, as models in a package are not used by default
// Schedule::command('model:prune')->daily();
```

## Testing
Expand Down

0 comments on commit a21e227

Please sign in to comment.