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

[8.x] Add documentation for optional 'exclude' parameter of the PruneCommand #7470

Merged
merged 3 commits into from
Nov 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,12 @@ Behind the scenes, the `model:prune` command will automatically detect "Prunable
'--model' => [Address::class, Flight::class],
])->daily();

If you wish to exclude certain models from being pruned while pruning all other detected models, you may use the `--except` option:

$schedule->command('model:prune', [
'--except' => [Address::class, Flight::class],
])->daily()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed a closing semi-colon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Can you submit a PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I will.


You may test your `prunable` query by executing the `model:prune` command with the `--pretend` option. When pretending, the `model:prune` command will simply report how many records would be pruned if the command were to actually run:

php artisan model:prune --pretend
Expand Down