samedi 23 janvier 2016

How to Remove Filter from Some of My Routes Laravel 4.2

I have routes for my project and I'm using Route::when('*', 'auth') to protect my routes by implement auth filter on every Route like given below:

// All the following routes must be filtered by the 'auth' filter.
Route::when('*', 'auth');

Route::resource('route_1', 'Controller_1);
Route::controller('route_2', 'Controller_2');
Route::get('route_3', 'Controller_3@method_1');

It's clear that the user can not access the routes as a guest or in other words without log into.

Now I'v to use a couple of routes which could be accessed without login. I'm using the following code but it's not working and also implement auth filter on route_0:

// Following two routes must not be filtered by the 'auth' filter.
Route::get('route_0', 'Controller_0@getMethod');
Route::post('route_0', 'Controller_0@postMethod');

// All the following routes must be filtered by the 'auth' filter.
Route::when('*', 'auth');

Route::resource('route_1', 'Controller_1);
Route::controller('route_2', 'Controller_2');
Route::get('route_3', 'Controller_3@method_1');

How can I remove auth filter from route_0? I also don't want to use auth filter separately on each route or controller. Any solution please?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1WEetxJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire