bantenprov/vue-trust

Manage trust using vuejs

dev-master 2018-05-17 11:38 UTC

This package is not auto-updated.

Last update: 2024-05-12 03:02:55 UTC


README

Join the chat at https://gitter.im/vue-trust/Lobby Scrutinizer Code Quality Build Status Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads

Manage laravel permission using vuejs

Install via composer

$ composer require bantenprov/vue-trust:dev-master

Edit config/app.php

'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,

publish asset

$ php artisan vendor:publish --tag=vue-trust-assets

tambahkan pada resources/assets/js/routes/routes.js

...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

tambahkan pada resources/assets/js/app.js

//.......
//== vue trust menus
import vuetrust_menu from './components/bantenprov/vue-trust/vuetrust_menu';

run dev ( development )

$ npm run dev

lanjutkan install laratrust

instalasi dan pengaturan laratust dapat dilihat disini

setelah install dan kofigurasi laratrust lanjutkan :

Edit app/Role.php & app/Permission.php

<?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'];
}