Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md to Laravel 11 Schedule for Prune #213

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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