Skip to content

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

Merged
taylorotwell merged 1 commit into
laravel:5.3from
memu:patch-1
Sep 5, 2016
Merged

[5.3] Fix lower case model names in policy classes#15270
taylorotwell merged 1 commit into
laravel:5.3from
memu:patch-1

Conversation

@memu

@memu memu commented Sep 4, 2016

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

Please give an example of what this fixes.

@memu

memu commented Sep 5, 2016

Copy link
Copy Markdown
Contributor Author

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