Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

abort() function is not working in Laravel 5.2

I wanted to use the abort function but it is not working. Here is the code i am using. I am currently run this code on Laravel 5.2

Route::get('/test',function(){
abort(403);
});

It generates the following error

HttpException in Application.php line 905:

I wanted to ask this function is still available or what i am doing wrong.

like image 934
habib Avatar asked Oct 23 '25 01:10

habib


1 Answers

It's expected behavior to show exception screen for abort calls from ~4.x: https://github.com/laravel/framework/issues/912

use response with status code:

Route::get('/test',function(){
  return response(null, 403);
});

with abort: abort

with response(null, 403): response

like image 115
num8er Avatar answered Oct 24 '25 15:10

num8er