bezhanSalleh / filament-shield

The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages & Widgets through `spatie/laravel-permission`
MIT License
1.35k stars 166 forks source link

Documentation Update for Laravel 11 - Custom folder structure for Models or Third-Party Plugins #366

Closed Solankill closed 3 months ago

Solankill commented 3 months ago

Regarding Custom folder structure for Models or Third-Party Plugins. With Laravel 11, you must now do this.

`namespace App\Providers;

use Illuminate\Support\Facades\Gate; use Illuminate\Support\ServiceProvider; use RickDBCN\FilamentEmail\Models\Email; use App\Policies\EmailPolicy;

class AuthServiceProvider extends ServiceProvider { public function boot() { $this->registerPolicies(); // Manually register policies

    // Manually define gates or policies if needed
    Gate::policy(Email::class, EmailPolicy::class);

}

protected function registerPolicies()
{
    // Manually register each policy
    Gate::policy('RickDBCN\FilamentEmail\Models\Email', 'App\Policies\EmailPolicy');
}

public function register()
{
    //
}

} `

bezhanSalleh commented 3 months ago

This aint an issue, you could submit a pr to update the docs