I'm developing a system with Laravel and I have the following goal: To make only the administrator user able to register new users. My problem is not blocking the access of ordinary users to the user registry, but rather make the user registry accessible with the Administrator logged in, because in the standard way the user registration happens without the user being logged in and when I put a button inside the system directing to the user registry it blocks, redirects to the home. In case my system is all set, only the user registry is accessible. I hope I made my problem clear.
Registration Function:
public function salvar()
{
$name = request()->input('name');
$email = request()->input('email');
$password = request()->input('password');
$passwords = bcrypt($password);
DB::insert('INSERT INTO users (name, email, password) VALUES (?, ?, ?)', array($name, $email, $passwords));
return redirect() ->action('HomeController@index');
}