1

I'm starting working with Laravel5 and I need to make app with some parts - e.g.:

admin.example.com
app.example.com
example.com

It means: in app will have registered users access, in admin, there will have access administrators and example.com will be for everybody.

I know, that this can be done in Symfony 2 via bundles, but I'm not sure, what's the best way to make it in Laravel 5.

Could you give me please your opinion about this?

Michael
  • 32,527
  • 49
  • 210
  • 370
Jan Kožušník
  • 683
  • 3
  • 16
  • 30

2 Answers2

4

In Laravel, bundles are called packages. You could also use a custom package to easily split your application into modules. Here's the same question asked with some answers.

Hope this puts you on the right path.

Pawel Bieszczad
  • 12,925
  • 3
  • 37
  • 40
1

You can make hostname based routing using route groups. Using something like the following you can easily distinct between roles:

Route::group(['domain' => '{type?}.example.com'], function()
{
    // .. do some logic based on type, eg change the controller
    Route::get('user/{id}', function($type, $user_id)
    {
        //
    });

});

Please note that this functionality is native to the core of Laravel.

Luceos
  • 6,629
  • 1
  • 35
  • 65
  • Hm, seems good. And how could I separate app into three folders -> app, admin, website ? – Jan Kožušník May 07 '15 at 17:02
  • What are you trying to achieve? Your comment is a follow up question based on the question asked here. Please elaborate. – Luceos May 08 '15 at 05:29
  • I'm trying to create three parts application -> with administration part, with app part (part for logged in users), and website part -> normally visible part, no need login... – Jan Kožušník May 08 '15 at 08:29
  • You're still not explaining how the folders fit into your question. Are those physical folders on disk or vendor folders or .. ? – Luceos May 08 '15 at 09:32
  • 1
    Thats, what I dont know, how to solve this in Laravel5. I need to create 3 parts app and I don't know, which way is the best one in Laravel – Jan Kožušník May 09 '15 at 09:27