E
E
Evgeny Perin2015-06-01 21:42:44
Laravel
Evgeny Perin, 2015-06-01 21:42:44

Separation into backend and frontend in laravel 5?

How do you separate the project into frontend and admin? If you do without any extensions, what is the sequence of actions? How are users filtered, through middleware or something else? I tried using middleware, but somehow I got confused, I got one controller for the entire admin panel))
I am new to frameworks, although I have been trying to approach them for quite a long time ... Please tell me

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Perin, 2015-06-02
@seoperin

I did it, please correct it if it's not correct ...
In routes:

Route::filter('admin', function(){
    if(Auth::check()){
        //Проверяем является ли юзер админом
        if(Auth::User()->role != 'admin'){
            return Redirect::to('/');
        }
    }else{
        return Redirect::guest('auth/login');
    }
});

Further admin routes:
Route::group(['prefix' => 'admin', 'before' => 'admin'], function(){
        .........
});

A
Alexey, 2015-06-02
@xelam

Usually like this:
1. routes for the front
2. group of routes for the admin.
3. rights, general or for the admin panel, but for the front (you can use packages)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question