How do you return an Eloquent model to the browser as JSON? What is the difference between the two methods below? Both seems to work.
#1:
this solved my problem in laravel 5.5:
function allUsers() { $users = \App\User::all(); $usersJson = json_encode($users); return $usersJson; }