jadjoubran / laravel5-angular-material-starter

Get started with Laravel 5.3 and AngularJS (material)
https://laravel-angular.readme.io/
MIT License
1.66k stars 400 forks source link

Should return 404 not 500 #421

Closed nueko closed 7 years ago

nueko commented 8 years ago
Route::current();

returns null on invalid route, so it will call getPrefix() on null that throws 500 instead 404. also, what if the api has no prefix, but subdomain based api?

I think it should check for the middlewares existance, like follows (You can do it better than me)


    /**
     * Check for api routes.
     *
     * @param Request $request
     * @return bool
     */
    protected function isApiRoute($request)
    {
        return $request->route() && in_array('api', (array) $request->route()->middleware());
    }
jadjoubran commented 7 years ago

Fixed