当前位置: 首页>>代码示例>>PHP>>正文


PHP Role::byLabel方法代码示例

本文整理汇总了PHP中app\models\Role::byLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::byLabel方法的具体用法?PHP Role::byLabel怎么用?PHP Role::byLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Role的用法示例。


在下文中一共展示了Role::byLabel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $role = Role::byLabel('admin')->first();
     $user = new User();
     $user->username = "admin";
     $user->email = "admin@simonev.co";
     $user->status = 1;
     $user->password = Hash::make('password');
     $role->users()->save($user);
     $role = Role::byLabel('evaluator')->first();
     $user = new User();
     $user->username = "evaluator";
     $user->email = "evaluator@simonev.co";
     $user->status = 1;
     $user->password = Hash::make('password');
     $role->users()->save($user);
 }
开发者ID:miarizkim,项目名称:simonev,代码行数:22,代码来源:UserTableSeeder.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $admin = Role::byLabel('admin')->first();
     $widyaiswara = Role::byLabel('widyaiswara')->first();
     $guru = Role::byLabel('guru')->first();
     $evaluator = Role::byLabel('evaluator')->first();
     $stakeholder = Role::byLabel('stakeholder')->first();
     $menu = new Menu();
     $menu->id = "01";
     $menu->label = "Dashboard";
     $menu->link = "/";
     $menu->icon = "si si-speedometer";
     $menu->position = 1;
     $menu->privileges = json_encode(['ACCESS']);
     $menu->save();
     $admin->menus()->attach("01", ['privileges' => 'ACCESS']);
     $widyaiswara->menus()->attach("01", ['privileges' => 'ACCESS']);
     $guru->menus()->attach("01", ['privileges' => 'ACCESS']);
     $evaluator->menus()->attach("01", ['privileges' => 'ACCESS']);
     $stakeholder->menus()->attach("01", ['privileges' => 'ACCESS']);
     /* Master */
     $menu = new Menu();
     $menu->id = "02";
     $menu->label = "Data Master";
     $menu->link = "#";
     $menu->icon = "si si-bulb";
     $menu->position = 2;
     $menu->privileges = json_encode(['ACCESS']);
     $menu->save();
     $admin->menus()->attach("02", ['privileges' => 'ACCESS']);
     $menu = new Menu();
     $menu->id = "0205";
     $menu->label = "Wilayah Geografis";
     $menu->link = "#";
     $menu->icon = "si si-globe";
     $menu->position = 1;
     $menu->parent_id = "02";
     $menu->privileges = json_encode(['ACCESS']);
     $menu->save();
     $admin->menus()->attach("0205", ['privileges' => 'ACCESS']);
     $menu = new Menu();
     $menu->id = "020501";
     $menu->label = "Provinsi";
     $menu->link = "/master/geografis/provinsi";
     $menu->position = 1;
     $menu->parent_id = "0205";
     $menu->privileges = json_encode(['ACCESS', 'ADD', 'EDIT', 'DELETE']);
     $menu->save();
     $admin->menus()->attach("020501", ['privileges' => 'ACCESS,ADD,EDIT,DELETE']);
     $menu = new Menu();
     $menu->id = "020502";
     $menu->label = "Kota & Kabupaten";
     $menu->link = "/master/geografis/kota";
     $menu->position = 1;
     $menu->parent_id = "0205";
     $menu->privileges = json_encode(['ACCESS', 'ADD', 'EDIT', 'DELETE']);
     $menu->save();
     $admin->menus()->attach("020502", ['privileges' => 'ACCESS,ADD,EDIT,DELETE']);
     // $menu = new Menu;
     // $menu->id = "020503";
     // $menu->label = "Kecamatan";
     // $menu->link = "/master/geografis/kecamatan";
     // $menu->position = 1;
     // $menu->parent_id = "0205";
     // $menu->privileges = json_encode(['ACCESS','ADD','EDIT','DELETE']);
     // $menu->save();
     // $admin->menus()->attach("020503", ['privileges' => 'ACCESS,ADD,EDIT,DELETE']);
     $menu = new Menu();
     $menu->id = "0201";
     $menu->label = "Program Diklat";
     $menu->link = "/master/diklat";
     $menu->icon = "si si-badge";
     $menu->position = 1;
     $menu->parent_id = "02";
     $menu->privileges = json_encode(['ACCESS', 'ADD', 'DELETE', 'EDIT']);
     $menu->save();
     $admin->menus()->attach("0201", ['privileges' => 'ACCESS,ADD,EDIT,DELETE']);
     $menu = new Menu();
     $menu->id = "0202";
     $menu->label = "Periode & Gelombang";
     $menu->link = "#";
     $menu->icon = "si si-clock";
     $menu->position = 2;
     $menu->parent_id = "02";
     $menu->privileges = json_encode(['ACCESS']);
     $menu->save();
     $admin->menus()->attach("0202", ['privileges' => 'ACCESS']);
     $menu = new Menu();
     $menu->id = "020201";
     $menu->label = "Periode";
     $menu->link = "/master/periode";
     $menu->position = 1;
     $menu->parent_id = "0202";
     $menu->privileges = json_encode(['ACCESS', 'ADD', 'DELETE', 'EDIT']);
     $menu->save();
//.........这里部分代码省略.........
开发者ID:miarizkim,项目名称:simonev,代码行数:101,代码来源:MenuTableSeeder.php


注:本文中的app\models\Role::byLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。