Reputation: 1436
I'm new to laravel so if my question is not up to the mark then forgive me but I googled it and not found answer as per my requirement.I follow https://laracasts.com/discuss/channels/laravel/setup-different-frontend-backend-endpoints-in-laravel-51 && https://laracasts.com/discuss/channels/general-discussion/splitting-admin-and-front-end
MY NEED :
I want 2 entry point for my laravel application. one is for front user and second for admin user.
I am using laravel latest version (5.3.26).
As we know public folder is the entry point for laravel application.
Ex : http://localhost/news_report_old/public/index.php
Using above URl we can enter into application. Right ?
Now I want to create new entry point for Admin So I thing I can copy public folder and rename it so my work is done but I missing something and I can't figure out what I am missing ?
EX : http://localhost/news_report_old/admin/index.php
So when I open above URL I want to open Admin side.
How can I achieve this ?
Thanks.
Upvotes: 0
Views: 832
Reputation:
You, don't need to copy public folder. That is terrific idea. (Don't ever mess with core/structure framework code, unless you have no any other option)
You can distinguish front end and admin panel easily using router and middleware.
You should create a custom middelware:
https://laravel.com/docs/5.3/middleware
And routing can be like:
routes/web.php:
// List of all front end routes:
Route::get('/', 'ArticleController@index');
Route::get('/home', 'HomeController@index');
Route::get('/about', 'HomeController@about');
// List of all admin routes
Route::group(['prefix' => 'admin', 'middleware' => 'admin']], function () {
Route::resource('admin', 'AdminController')
});
Upvotes: 2