Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     // dd(Helper::makePermissionsCRUD($request->privilege));
     $array_of_permissions = Helper::makePermissionsCRUD($request->privilege);
     foreach ($array_of_permissions as $key => $permission) {
         $privilege = new Privilege();
         $privilege->permission = $permission;
         $privilege->status_id = 1;
         $privilege->save();
     }
     return \Redirect::to('settings/roles');
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data['title'] = 'Roles & Privileges';
     $data['permissions'] = Privilege::lists('permission', 'permission');
     $data['allPersmissions'] = Privilege::all();
     $data['roles'] = Role::where('slug', '!=', 'super_administrator')->get();
     // foreach ($data['roles'] as $role) {
     //     echo $role->permissions;
     // }
     return view('settings.roles.roles', $data);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Privilege::create(['title' => 'Admin', 'page_id' => 1, 'create' => 1, 'read' => 1, 'update' => 1, 'delete' => 1]);
     Privilege::create(['title' => 'User', 'page_id' => 1, 'create' => 1, 'read' => 1, 'update' => 1, 'delete' => 1]);
 }