lundi 10 octobre 2016

Is it worth using entrust with Dingo API? Is there a better way?

I'm using Laravel 5 for my next project. I need to apply some role logic for the working. So here's what I've came up with:

$api = app('Dingo\Api\Routing\Router');

//admin routes!
$api->version('v1', ['middleware' => ['ability:admin,create-users']],
function ($api) {
$api->get('dingocheck', 'App\Http\Controllers\AdminController@index');
});

//store routes
$api->version('v1', ['middleware' => ['ability:store,create-products']],        
function ($api) {
$api->get('dingocheck', 'App\Http\Controllers\StoreController@index');
});

//userroutes
$api->version('v1', ['middleware' => ['ability:admin,puchase-products']],       
function ($api) {
$api->get('dingocheck', 'App\Http\Controllers\UserController@index'); });

I'm yet to resolve how to manage the modelling within the application. Thanks for help (:



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire