Filament Shield
How to apply shield to third party plugins? I have disabled plugin menu in shield, but non authorized user still can access it
4 Replies
Have you tried modifying your AuthServiceProvider as per the instructions in the docs? See this section: "Custom folder structure for Models or Third-Party Plugins"
In my laravel project there is no AuthServiceProvider file
@Hasbullah you can add one, or even just add a "Gate::policy( 'Model\Name', 'Policy\Name' )" to your AppServiceProvider boot for a quick test. To register your own provider, add to /Bootstrap/providers.php. If you extend "Illuminate\Foundation\Support\Providers\AuthServiceProvider", you only need to override the $policies []. You can take a look at the core AuthServiceProvider to see how it registers everything in $policies with Gate. Anyhow, something like this should do it:
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
protected $policies = [
'Spatie\Permission\Models\Role' => 'App\Policies\RolePolicy',
];
}
Ok thanks, i will try