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 optional 'exclude' parameter to the PruneCommand #39749

Merged
merged 1 commit into from Nov 24, 2021
Merged

[8.x] Add optional 'exclude' parameter to the PruneCommand #39749

merged 1 commit into from Nov 24, 2021

Conversation

jochensengier
Copy link
Contributor

This PR adds an optional 'exclude' parameter to the Illuminate\Database\Console\PruneCommand in order to exclude certain models that were automatically detected within the application's app\Models directory.

$schedule->command('model:prune', [
    '--exclude' => [Test::class, Example::class],
])->daily()

Of course, you could argue to remove the Illuminate\Database\Eloquent\Prunable or Illuminate\Database\Eloquent\MassPrunable trait from those models.

But what if you have a base class within the application's app\Models directory, which is implemented by other models and implements one of the above traits?

That base class will not be able to return an \Illuminate\Database\Eloquent\Builder instance, as it does not have a corresponding database table.

Looking forward to any feedback and suggestions regarding this PR.

Thanks!

@taylorotwell taylorotwell merged commit 779adea into laravel:8.x Nov 24, 2021
taylorotwell added a commit to laravel/docs that referenced this pull request Nov 29, 2021
…Command (#7470)

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

laravel/framework#39749

* Update eloquent.md

* Update eloquent.md

Co-authored-by: Taylor Otwell <taylor@laravel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants