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:
Response::json($someArray) is a generic way to return JSON data.
Response::json($someArray)
return $model->toJson() is specific to returning a model as JSON. This would be my preferred approach when working with an Eloquent model.
return $model->toJson()