Open wikihadi opened 2 months ago
I agree, it's a nice Filament feature to have possibility to use sub folders for Models / Resources, but they won't work with Filament Shield when using subfolders... Any idea how to fix this ? thks
I also agree with you in filament docus they mentionds for subdirectories path used AuthServiceProvider but in laravel 11 there's not AuthServiceProvider class.
Hi
According to the changes of Laravel 11 (https://laravel.com/docs/11.x/authorization#manually-registering-policies) and also the documentation of this package (https://github.com/bezhanSalleh/filament-shield?tab=readme-ov-file#custom-folder-structure-for-models-or-third-party-plugins)
, to fix the problem:
Should manually register policies and their corresponding models within the boot
method of your application's AppServiceProvider
:
use App\Models\Order;
use App\Policies\OrderPolicy;
use Illuminate\Support\Facades\Gate;
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Gate::policy(Order::class, OrderPolicy::class);
}
Resoures in the sub folders accessable by everyone
![داشبوردا](https://github.com/bezhanSalleh/filament-shield/assets/4249202/677f0b1d-7b06-42db-a168-1c64d55b0cb1)