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 1 commit
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
9 changes: 8 additions & 1 deletion eloquent.md
Original file line number Diff line number Diff line change
Expand Up @@ -938,12 +938,19 @@ After configuring your prunable model, you should schedule the `model:prune` Art
$schedule->command('model:prune')->daily();
}

Behind the scenes, the `model:prune` command will automatically detect "Prunable" models within your application's `app/Models` directory. If your models are in a different location, you may use the `--model` option to specify the model class names:
Behind the scenes, the `model:prune` command will automatically detect "Prunable" models within your application's `app/Models` directory.
If your models are in a different location, you may use the `--model` option to specify the model class names:

$schedule->command('model:prune', [
'--model' => [Address::class, Flight::class],
])->daily();

If you wish to exclude certain model class names from being automatically detected within your application's `app/Models` directory, use the `--exclude` option:

$schedule->command('model:prune', [
'--exclude' => [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