You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After php artisan make:policy RolePolicy --model=Role:
<?php
namespace App\Policies;
use App\User;
use Vyuldashev\NovaPermission\Role;
use Illuminate\Auth\Access\HandlesAuthorization;
class RolePolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any company.
*
* @param \App\User $user
* @return mixed
*/
public function viewAny(User $user)
{
return false;
}
/**
* Determine whether the user can view the role.
*
* @param \App\User $user
* @param \App\Role $role
* @return mixed
*/
public function view(User $user, Role $role)
{
//
}
...
and update AuthServiceProvider:
<?php
namespace App\Providers;
use App\Company;
use Vyuldashev\NovaPermission\Role;
use Vyuldashev\NovaPermission\Permission;
use App\Policies\CompanyPolicy;
use App\Policies\RolePolicy;
use App\Policies\PermissionPolicy;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
Company::class => CompanyPolicy::class,
Role::class => RolePolicy::class,
Permission::class => PermissionPolicy::class,
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
//
}
}
There is no effect. View, edit and delete icons are still there:
Did I get the vyuldashev Role model namespace wrong?
The text was updated successfully, but these errors were encountered:
Originally posted by @vyuldashev in #27 (comment)
After
php artisan make:policy RolePolicy --model=Role
:and update
AuthServiceProvider
:There is no effect. View, edit and delete icons are still there:
Did I get the vyuldashev Role model namespace wrong?
The text was updated successfully, but these errors were encountered: