Description
I'm making an API REST in Laravel, when I use the controller, it's not returning data, but when I use Laravel Tinker, it works fine and returns data.
In the controller
public function show(Ups $trademark){
return Ups::where('trademark','=', $trademark)->get();
}
In Laravel Tinker
Ups::where('trademark','=', 'Schneider')->get();
App\Ups {781
_id: MongoDB\BSON\ObjectID {763
+"oid": "59aea41e0bc6b8581e35e572",
},... . .. .
But when I call the method show from the api, returns nothing.
api/upss/Schneider
(2/2) NotFoundHttpException
No query results for model [App\Ups].
I tried the same thing with the Index method, and it works perfectly, it returns the whole collection in Json.
My api.php in Laravel
Route::get('upss', '\App\Http\Controllers\Api\UpsApiController@index'); Route::get('upss/{trademark}', '\App\Http\Controllers\Api\UpsApiController@show');