vendredi 28 août 2015

Multisite CMS in Laravel 5.1, one backend, same server, folders, assets & general structure concerns

I´m just starting to learn Laravel and decided to build a new version of my current CMS system with Laravel 5.1. It will be a CMS with one admin and multiple sites.

I figured that since each site will be using different assets in the public folder, I would need to create different public folder for each app.

So instead of 'app/public', I have 'app/sites/Admin' with it´s own unique css files, images, etc. I´ve already built the Admin part, with it´s proper views, assets, models, controllers, etc, and it´s (apparently) working fine.

So when I started developing the "Time da ANABB" site, I followed the same process: created it´s own controllers in it´s own folder, it´s own views, etc.

But when I tried it out, the route does point to the proper view, but all my links to CSS, imgs, etc are broken. When I output {!! public_path() !!} on this site´s view, I get it point to "C:\Users\Martin\Dropbox\www\sistema-lengro\public"

So I´m not sure if I need to config a different public folder for each site (and if that´s the right thing to do!) or if I´m all wrong... Again, this is basically my first major project in laravel...

Some of my configs are:

I´m using Virtual Hosts and route groups to address each request, as in:

//Admin Route::group(['middleware' => 'auth', 'domain' => 'dev.sistema', 'namespace' => 'Admin'], function () { Route::get('admin', function () { return view('admin.painel'); }); }

//Site Route::group(['domain' => 'dev.timedaanabb', 'namespace' => 'TimeDaAnabb'], function () { Route::get('/', function () { return view('sites.timedaanabb.pages.home'); }); });

I´ve also created a controllers folder for each, like 'app/Http/Controllers/Admin' and 'app/Http/Controllers/TimeDaAnabb'. For the Models, will be 'app/Admin/Users.php', for example.

I don´t know if that´s the best approach, but it´s working fine so far.

Thank you in advance!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1UhtHpu
via IFTTT

Aucun commentaire:

Enregistrer un commentaire