Manage laravel permission using vuejs
$ composer require bantenprov/vue-trust:dev-master
'providers' => [
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
//................
Bantenprov\VueTrust\VueTrustServiceProvider::class,
$ php artisan vendor:publish --tag=vue-trust-assets
...authGuard([
{
path: '/admin',
name: 'admin',
redirect: '/admin/dashboard',
component: layout('Default'),
children: [
//=== vue trust route
{
path: '/admin/vue-trust/role',
components: {
main: resolve => require(['~/components/bantenprov/vue-trust/role/role.index.vue'], resolve),
navbar: resolve => require(['~/components/Navbar.vue'], resolve),
sidebar: resolve => require(['~/components/Sidebar.vue'], resolve)
},
meta: {
title: "Role"
}
},
{
path: '/admin/vue-trust/role/create',
components: {
main: resolve => require(['~/components/bantenprov/vue-trust/role/role.create.vue'], resolve),
navbar: resolve => require(['~/components/Navbar.vue'], resolve),
sidebar: resolve => require(['~/components/Sidebar.vue'], resolve)
},
meta: {
title: "Role"
}
},
{
path: '/admin/vue-trust/role/:id/set-permission',
components: {
main: resolve => require(['~/components/bantenprov/vue-trust/role/role.setpermission.vue'], resolve),
navbar: resolve => require(['~/components/Navbar.vue'], resolve),
sidebar: resolve => require(['~/components/Sidebar.vue'], resolve)
},
meta: {
title: "Role"
}
},
{
path: '/admin/vue-trust/role/:id/show',
components: {
main: resolve => require(['~/components/bantenprov/vue-trust/role/role.show.vue'], resolve),
navbar: resolve => require(['~/components/Navbar.vue'], resolve),
sidebar: resolve => require(['~/components/Sidebar.vue'], resolve)
},
meta: {
title: "Role"
}
},
{
path: '/admin/vue-trust/role/:id/edit',
components: {
main: resolve => require(['~/components/bantenprov/vue-trust/role/role.edit.vue'], resolve),
navbar: resolve => require(['~/components/Navbar.vue'], resolve),
sidebar: resolve => require(['~/components/Sidebar.vue'], resolve)
},
meta: {
title: "Role"
}
},
{
path: '/admin/vue-trust/permission',
components: {
main: resolve => require(['~/components/bantenprov/vue-trust/permission/permission.index.vue'], resolve),
navbar: resolve => require(['~/components/Navbar.vue'], resolve),
sidebar: resolve => require(['~/components/Sidebar.vue'], resolve)
},
meta: {
title: "Permission"
}
},
{
path: '/admin/vue-trust/permission/create',
components: {
main: resolve => require(['~/components/bantenprov/vue-trust/permission/permission.create.vue'], resolve),
navbar: resolve => require(['~/components/Navbar.vue'], resolve),
sidebar: resolve => require(['~/components/Sidebar.vue'], resolve)
},
meta: {
title: "Permission"
}
},
{
path: '/admin/vue-trust/permission/:id/show',
components: {
main: resolve => require(['~/components/bantenprov/vue-trust/permission/permission.show.vue'], resolve),
navbar: resolve => require(['~/components/Navbar.vue'], resolve),
sidebar: resolve => require(['~/components/Sidebar.vue'], resolve)
},
meta: {
title: "Permission"
}
},
{
path: '/admin/vue-trust/permission/:id/edit',
components: {
main: resolve => require(['~/components/bantenprov/vue-trust/permission/permission.edit.vue'], resolve),
navbar: resolve => require(['~/components/Navbar.vue'], resolve),
sidebar: resolve => require(['~/components/Sidebar.vue'], resolve)
},
meta: {
title: "Permission"
}
},
//=== end vue trust route
//.......
//== vue trust menus
import vuetrust_menu from './components/bantenprov/vue-trust/vuetrust_menu';
$ npm run dev
instalasi dan pengaturan laratust dapat dilihat disini
<?php
namespace App;
use Laratrust\Models\LaratrustRole;
class Role extends LaratrustRole
{
public $fillable = ['name', 'display_name', 'description'];
}
<?php
namespace App;
use Laratrust\Models\LaratrustPermission;
class Permission extends LaratrustPermission
{
public $fillable = ['name', 'display_name', 'description'];
}