Inside a controller in Laravel I have this:
public function index()
{
$users = User::orderBy('name', 'asc')->paginate(13);
$users2 = User::all();
return view('contatos.index')->with('users', $users);
return view('auth.register')->with('users', $users2);
}
I know isn't right, it's just to demonstrate my logic. Is there a way to unite these two returns in a single return? Or even a much shorter form for this code?