bump. I'd really like to use Laravel as base for my projects, but i need a way to create multiple entry points with some shared resources across all of them. Any hints appreciated :)
I am currently doing almost the same thing, I'd like to hear some advices too
I am doing the same.. This is how i organized my folders:
// load my shared array data
// coontrollers
//models
// frontend views
// backend views
//any customer view
// Backend subdomain
Route::group(array('domain' => 'backend.mydomain.com'), function()
{
// Public
Route::get('/login', function()
{
return View::make('backend.login.index');
});
// AUTHENTICATION REQUIRED
Route::group(array('before' => 'auth'), function()
{
///add your routers here....
});//end auth
});//end domain
// front end subdomain
Route::group(array('domain' => 'frontend.mydomain.com'), function()
{
// Public
Route::get('/login', function()
{
return View::make('backend.login.index');
});
// AUTHENTICATION REQUIRED
Route::group(array('before' => 'auth'), function()
{
///add your routers here....
});//end auth
});//end domain
// any customer
Route::group(array('domain' => 'customername.mydomain.com'), function()
{
///add your routers here....
});//end domain
It would be helpful if you explain what the folders are for even the obvious ones just to know we are on the same page.
Here's a simple route pattern for a separate admin area:
Route::group(array('prefix' => 'admin'), function()
{
//put admin routes here
});
//put front-end routes here
You could add a namespace to the autoloader and keep your files seperated like this folder structure.
App\ACME\Admin App\ACME\Admin\composers App\ACME\Admin\controllers App\ACME\Admin\controllers\BaseControlle App\ACME\Admin\views App\ACME\Admin\services App\ACME\Admin\AdminServiceProvider.php
App\ACME\Data App\ACME\Data\Models App\ACME\Data\Observers App\ACME\Data\Repositories App\ACME\Data\DataServiceProvider.php
App\ACME\Site App\ACME\Site\composers App\ACME\Site\controllers App\ACME\Site\controllers\BaseController App\ACME\Site\views App\ACME\Site\services App\ACME\Site\SiteServiceProvider.php
I think its best to go with @juukie14 by using namespaces.
For e.g. you can do
App
-- Models
-- Backend
-- Frontend
And inside the folder go with
<?php namespace Backend;
juukie14 said:
You could add a namespace to the autoloader and keep your files seperated like this folder structure.
App\ACME\Admin App\ACME\Admin\composers App\ACME\Admin\controllers App\ACME\Admin\controllers\BaseControlle App\ACME\Admin\views App\ACME\Admin\services App\ACME\Admin\AdminServiceProvider.php
App\ACME\Data App\ACME\Data\Models App\ACME\Data\Observers App\ACME\Data\Repositories App\ACME\Data\DataServiceProvider.php
App\ACME\Site App\ACME\Site\composers App\ACME\Site\controllers App\ACME\Site\controllers\BaseController App\ACME\Site\views App\ACME\Site\services App\ACME\Site\SiteServiceProvider.php
@juunkie14 If you separate the admin like that how do I load a view file since blade files aren't namespaces? Would I just prefix it with the namespace like this View:make('ACME\Admin:index');
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community