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

[5.3] Fix lower case model names in policy classes #15270

Merged
merged 1 commit into from
Sep 5, 2016
Merged

[5.3] Fix lower case model names in policy classes #15270

merged 1 commit into from
Sep 5, 2016

Conversation

memu
Copy link
Contributor

@memu memu commented Sep 4, 2016

Fixes the model name variables (from lower case to camel case) when generating a policy class based on a model.

Fixes the model name variables (from lower case to camel case) when generating a policy class based on a model.
@taylorotwell
Copy link
Member

Please give an example of what this fixes.

@memu
Copy link
Contributor Author

memu commented Sep 5, 2016

If a policy class is generated based on a model, the parameters of that class methods are lower case.

php artisan make:policy ProductCategoryPolicy --model=ProductCategory

class ProductCategoryPolicy
{

    // before fix

    /**
     * Determine whether the user can view the productcategory.
     *
     * @param  App\User  $user
     * @param  App\ProductCategory  $productcategory
     * @return mixed
     */
    public function view(User $user, ProductCategory $productcategory)
    {
        //
    }


    // after fix
    // "productcategory" --> "productCategory"


    /**
     * Determine whether the user can view the productCategory.
     *
     * @param  App\User  $user
     * @param  App\ProductCategory  $productCategory
     * @return mixed
     */
    public function view(User $user, ProductCategory $productCategory)
    {
        //
    }
}

@taylorotwell taylorotwell merged commit 903efd6 into laravel:5.3 Sep 5, 2016
@memu memu deleted the patch-1 branch September 6, 2016 20:57
tillkruss pushed a commit to tillkruss/framework that referenced this pull request Sep 8, 2016
Fixes the model name variables (from lower case to camel case) when generating a policy class based on a model.
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.

2 participants