I am using Laravel 5 and have declared a route that corresponds to a controller action but it gives an error of "This webpage has a redirect loop"
and net::ERR_TOO_MANY_REDIRECTS
in case of ajax calls.
My route is:
Route::get('getsubcategories/{id}', 'HomeController@getsubcategories')
->where('id', '[0-9]+');
Controller:
public function getsubcategories($id){
return "abc";
}
I don't know where the problem resides. Any suggestions ?
If you are using Form Request, make sure you are not injecting the class in the constructor.
My mistake was this:
public function __construct(SupplierFormRequest $supplier)
{
$this->supplier = $supplier;
}
instead of injecting the interface there.