The model is a user has many roles and a role has many users
User model
public function roles()
{
return $this->belongsToMany('App\Rol','usuarios_roles','idusuario','idrol');
}
role model
public function usuarios()
{
return $this->belongsToMany('App\User','usuarios_roles','idusuario','idrol');
}
I have seen the documentation but those examples do not work for me. What I need is to restrict a route by role. Example only users with see role can access the path ' users-start '. The create role can access the path users-createNew . This where is it defined? in the routes (I doubt it), in policies creating the file? or in authServicePrivider. I'm very confused