I'm fairly new to Laravel. I'm having a problem with routing.
Route::group(['prefix'=>'api/v1'],function(){
Route::resource('results','RequestController');
Route::get('results/getByName/{name}','RequestController@getByName');
Route::get('results/getLastTen','RequestController@getLastTen');
});
The problem is that the last route under prefix api/v1 does not work. When I call it it shows nothing, not even any error.
The code at the requestController is:
public function getLastTen(){
$results=DB::table('latest_random_trends')->limit(10)->get();
return $results;
}
Everything is alright with the code on the controller since it works when I call it from the routes.php file outside of the prefix 'api/v1' like this:
Route::get('results/getLastTen','RequestController@getLastTen');
but when it is inside the prefix it does not work unless I add a variable to it like this:
Route::get('results/getLastTen/{var}','RequestController@getLastTen');
/api/v1/results/getLastTen?