jgravois
jgravois

Reputation: 2579

Laravel 5: How can I achieve this Architecture?

Currently I have a Laravel 4 app that uses Laravel for authentication and persistence and an API and have a coupled AngularJS frontend for the staff to utilize but since I need to expand this, I figure I will upgrade to Laravel 5 at the same time.

How would you suggest I proceed architecturally to achieve the following:

[1] The admin "CMS" would be accessible to a very small select group of users and would be ALL Laravel and do basic CRUD operations. I'd like it to be at http://admin.domain.com (access: small subset of "staff" users)

[2] An API protected with JWT for the consumer application at http://www.domain.com/api/ (access: authenticated users of staff and client types)

[3] The staff portal - an Angular front-end via the API at http://staff.domain.com (access: all "staff" users)

[4] The client portal - an Ionic/Angular front-end via the API for public consumption at http://www.domain.com. (access: all "staff" users and registered "client" users.

Any advice is greatly appreciated.

Upvotes: 0

Views: 398

Answers (1)

Jhuliano Moreno
Jhuliano Moreno

Reputation: 989

Based in what you commented here is how you can achieve the multiple domain arquitecture:

Route::group(array('prefix'=>'subdomain'),function(){
  //Here you will add your routes that should be used within subdomain.yourdomain.com
});

For the login part you can basically create each user under a different groups/level and basically use the routes filter again to build your app perms. Something like this:

Route::group(array('namespace' => 'Admin'), function()
{
    //Add here your routes that should work only for admin
});

See http://laravel.com/docs/4.2/routing#route-groups for more information about routing.

Also if you want a more elegant solution for the permissions you could use some packages like Entrust or Verify

EDIT: If you want to go the routing way, you could use this tutorial as a good reference.

Upvotes: 1

Related Questions