dimanche 22 novembre 2015

Laravel 5.1 - Redirecting specific users on every page

I'm making a website where users can register before it launches. However when people with a specific email adress register they can already have acces to the full website, the others are put on a waiting list.

So let's say everyone with a gmail adress get's access and I want the rest to be redirected to the page /waiting list.


Example:

Gmail user:

Route::get('favorites', 'FavoriteController@index');

Hotmail user:

Route::get('favorites', 'FavoriteController@index')

-> let this redirect to

Route::get('waitlist', 'WaitlistController@index')


Is there an easy, short way to do this for every route, for example with an if, like this?

if(substr($user->email, -9)!= "@gmail.com")
{
    always redirect my routes to "Waitlist"
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire