You put stuff where you want in Laravel. It doesn't constrain you to a certain folder structure to put things into. As long as your classes are auto-loaded by composer then you are good to go.
I personally put my front-end stuff into app/ while making a new folder in the project root which is the projects name "Acme" for instance. I then use a PSR loading scheme on that and start coding. So Acme/Controllers/ is my backend controllers, Acme/Shop/Product is my product modal, etc.
Just make up what you want, autoload it, and set yourself free from being told where to put what all the time.
Like in Codeigniter
I have follow this :-
http://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with-CodeIgniter
So I think now you have clear my query.
i am building it this way.
i use sub-domains in the routers. backend.mydomain.com frontend.mydomain.com
Then on the controllers i have controller/backend controller/frontend
Views: /views/frontend/ views/backend/
very basic as you can see
Hello Extjac,
I want to do it like :-
For admin panel :-
abc.com/admin
and for front end :-
abc.com
And in controllers, models and views folder both are in separate folder. And both folder can contain the same name of class.
You probably are over thinking this...It is actually very simple.
I would create this folder and files structure:
#Models keep it simple
/app/models
#break controllers into two folders
#(make sure you update the /app/start/global.php with the folder structure
/app/controllers/
/app/controllers/admin
#front end views samples
/app/views/
/app/views/login/index.blade.php
/app/views/register/index.blade.php
/app/views/user/account.blade.php
/app/views/user/passwordremainder.blade.php
#backend views samples
/app/views/admin/
/app/views/admin/login/index.blade.php
/app/views/admin/user/index.blade.php
/app/views/admin/items/index.blade.php
Controllers:
#Front-end controller location /app/controller
#file name: UserController.php
<?php
class UserController extends Controller
{
public function getLogin()
{
return View::make('login.index');
}
}
#Backend-end controller location /app/controller/admin
#file name: AdminUserController.php
<?php
class AdmiinUserController extends Controller
{
public function getLogin()
{
return View::make('admin.login.index');
# Note that this view is pointing to the /views/admin/ folders
}
}
In the routers.php I do it this way:
#sample front end controller
Route::get('/login', 'UserController@getLogin');
#sample of admin controller
Route::get('/admin/login', 'AdminUserController@getLogin');
Unless I am missing your point, this is how i would do it.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community