Ravexina
Ravexina

Reputation: 2848

Laravel 5 returns blank page for a method which does not exist

I created a RESTful controller with artisan make:controller and i am using resource method at my routes.php, here is my routes.php:

Route::resource('page', 'PageController');

I don't have any edit method at my controller (i removed it) so if i hit this URI:

http://laravel.dev/page/{id}/edit

Laravel should return a 404 page but instance it returns a blank page.

how can i make it return 404 response for a method which does not exist?

Upvotes: 2

Views: 1252

Answers (1)

Ravexina
Ravexina

Reputation: 2848

Problem was with the permission of storage directory but I'm wondering why it's just happened at this controller? i had no problem with getting errors from other part of the application.

anyway first i changed the permission of the storage directory:

sudo chmod -R 777 storage/

then i got the MethodNotFoundException, so i add the only to the third part of resource method to customize my routes and every thing is fine:

Route::resource('page', 'PageController', ['only' => ['index', 'show'] ]);

now its throw NotFoundHttpException.

Upvotes: 1

Related Questions