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

Added --policy flag to model:make command #25787

Closed
wants to merge 1 commit into from
Closed

Added --policy flag to model:make command #25787

wants to merge 1 commit into from

Conversation

HSPDev
Copy link
Contributor

@HSPDev HSPDev commented Sep 26, 2018

A simple comfort feature.
We often issue:
php artisan make:model Models/ExampleModel --migration

And then go straight for creating a policy afterwards
php artisan make:policy ExampleModelPolicy --model Models/ExampleModel

This is a frustrating developer experience.

If this is merged, you can do:
php artisan make:model Models/ExampleModel --migration --policy

I've used "o" for shortcut for "pOlicy" as "p" was taken by "pivot".
-all flag still works as expected and also creates a policy.

…icy stubs while making models and migrations.
@HSPDev
Copy link
Contributor Author

HSPDev commented Sep 26, 2018

I don't have time to be a clever guy and attempt to have the Policy auto-registred in the AuthServiceProvider $providers array.

Laravel should really get Policy auto-discovery at some point.
The type safety of PHP should be able to catch any errors introduced by mismatching models.

The naming convention and creation process is tedious and redundant.
I will have a look at it, but this merge-request is a start.

@taylorotwell
Copy link
Member

We already have a lot of flags here. I would suggest just using the policy command after make:model manually.

@jmarcher
Copy link
Contributor

@nicknick-io What are you talking about? There are more than 12k PR merged... around 140 this month... Merged PR

@jmarcher
Copy link
Contributor

@nicknick-io You name comments or DocBlocks useless stuff? This is a framework, documentation is really important, I prefer to have every feature documented than a load of functions and features without documentation.

In an open source project, you will not be able to make everyone happy. Not every single PR can be merged just because someone spends time doing it.

@jmarcher
Copy link
Contributor

@nicknick-io Facepalm

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.

3 participants