Can Anyone help me with policy ?
I have some models inside folder also i created policy incide same named folder so that my folder structure looks good but policy isn't working example
example
models
App\Models\Shop\Example.php
Policies
App\Policies\Shop\ExamplePolicy.php
if i create policy like this policy didn't work in resource
but it works in
App\Models\Shop\Example.php
Policies
App\Policies\ExamplePolicy.php
also works in this
App\Models\Example.php
Policies
App\Policies\ExamplePolicy.php
btw my resource also in filament/resources/shop/
In general if i put my policy in folder it didn't work yes i check namespace and other thing it is correct
so how can i connect resource with policy in this situation
example
models
App\Models\Shop\Example.php
Policies
App\Policies\Shop\ExamplePolicy.php
if i create policy like this policy didn't work in resource
but it works in
App\Models\Shop\Example.php
Policies
App\Policies\ExamplePolicy.php
also works in this
App\Models\Example.php
Policies
App\Policies\ExamplePolicy.php
btw my resource also in filament/resources/shop/
In general if i put my policy in folder it didn't work yes i check namespace and other thing it is correct
so how can i connect resource with policy in this situation
Solution
By default policy in Filament is actually the policy rule set by Laravel:
https://laravel.com/docs/11.x/authorization#registering-policies
To customize this, go to your
This will follow same policy structure same as in model.
https://laravel.com/docs/11.x/authorization#registering-policies
To customize this, go to your
PanelProvider boot() method and add something like this:This will follow same policy structure same as in model.
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
