Am trying to add a route in my api.php in laravel, whereas all other api are working fine but newly added api is not working returning 404.
Route::get('products','Api\ProductsController@index');
Route::get('products/trending','Api\ProductsController@trendingProducts');
Products return data but when searched for trending it returns 404. Tried clearing route cache and checking in route list. The route exist in routelist. Even the function in controller also existl.
Controller Code :
public function trendingProducts(){
echo "i";
}
Confused by the unexpected behaviour. Any help will be gratefull. Thank you in advance.
abort()
or has afindOrFail()
in it? Have you cleared your routes cache?php artisan optimize:clear
– Qirel