I want to get REST url to retrieve data where name="hello" and category="main"
This is my Model
public function show($name, $category)
{
$FodMap = FodMap::find($name, $category);
return $FodMap;
}
Routes
Route::get('FodMap/{name}/{category}', 'FodMapController@show');
What I want is when I type localhost/api/FodMap/hello/main
All result should display which matches with hello and main
Please advise me to proceed.... I'm new to Laravel.
The eloquent query is something like this:
FodMap::where('name','=',$name)->where('category','=',$category)->get()
That will return an Eloquent Collection instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With