That's the way I found to create users as administrator and lower levels of roles. I know that there is a better and more clever way. Could anyone help me?
Let's see some code:
public function create()
{
if (Laratrust::hasRole('administrator')) {
$roles = Role::where('id','>', 1)->get();
return view('layouts.usuarios.create')->withRoles($roles);
} else {
$roles = Role::all();
return view('layouts.usuarios.create')->withRoles($roles);
}
}
As doing that, the role loop doesn't show the superadministrator one. How can I make this more efficient and dynamic?