I have an RESTful API with controllers that should return a JSON response when is being hit by my android application and a \"view\" when it\'s being hit by a web browser. I\'m
Use this Way. you can simply identify URL being call form ( Web or API )
Controller code
if ( Request::capture()->expectsJson() )
{ return "API Method"; }
else
{ return "Web Method"; }
Route Code
For api.php Route::post("category","CategoryController@index");
For Web.php Route::get("category","CategoryController@index");