Support the ongoing development of Laravel.io →
Authentication Security Requests

hello all am new to laravel and now am trying to build a web app with it, the problem i have that i need to create some route or filter that forces all my requests to be logged-in except for the login and register page.

i don't want to write that rule in every controller, just in one place.

Last updated 3 years ago.
0

It could be built as a route filter, but i would say the best an easiest way is to make a grouped route with auth-filter and simply put all routes except for auth related stuff there.

Last updated 3 years ago.
0

And here's the code

Route::group(['before'=>'auth'], function() {
	// put your routes here
});

Route::get('login', function() {

});

Route::get('register', function() {

});
Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

TehHector tehhector Joined 31 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.