• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP app\Permission类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中app\Permission的典型用法代码示例。如果您正苦于以下问题:PHP Permission类的具体用法?PHP Permission怎么用?PHP Permission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //Roles
     $userAdmin = new Role();
     $userAdmin->name = 'admin';
     $userAdmin->display_name = 'Administrator';
     $userAdmin->description = 'User is an admin and can edit and manage users';
     $userAdmin->save();
     $reportsUser = new Role();
     $reportsUser->name = 'reports-user';
     $reportsUser->display_name = 'Reports User';
     $reportsUser->description = 'Reports User can use Note Code Conflicts';
     $reportsUser->save();
     $csUser = new Role();
     $csUser->name = 'cs-user';
     $csUser->display_name = 'Customer Service User';
     $csUser->description = 'Customer Service User can Upload Notes Import';
     $csUser->save();
     //Permissions
     $userRegistration = new Permission();
     $userRegistration->name = 'user-reg';
     $userRegistration->display_name = 'User Registration';
     $userRegistration->description = 'Create new users admin only';
     $userRegistration->save();
     $manageUsers = new Permission();
     $manageUsers->name = 'manage-users';
     $manageUsers->display_name = 'Manage Users';
     $manageUsers->description = 'Manage Users - Permissions, etc.';
     $manageUsers->save();
     $reports = new Permission();
     $reports->name = 'reports';
     $reports->display_name = 'Reports Section';
     $reports->description = 'Access to reports section';
     $reports->save();
     $admin = new Permission();
     $admin->name = 'admin';
     $admin->display_name = 'Admin Section';
     $admin->description = 'Access to admin section';
     $admin->save();
     $dispositions = new Permission();
     $dispositions->name = 'dispositions';
     $dispositions->display_name = 'Disposition Uploads';
     $dispositions->description = 'Access to Disposition Uploads';
     $dispositions->save();
     $notesImport = new Permission();
     $notesImport->name = 'notes-import';
     $notesImport->display_name = 'Upload Notes Import';
     $notesImport->description = 'Access to upload notes import';
     $notesImport->save();
     $noteConflicts = new Permission();
     $noteConflicts->name = 'note-conflicts';
     $noteConflicts->display_name = 'Note Code Conflicts';
     $noteConflicts->description = 'Access to Node Code Conflicts';
     $noteConflicts->save();
     $batchRefund = new Permission();
     $batchRefund->name = 'batch-refund';
     $batchRefund->display_name = 'Batch Refunds';
     $batchRefund->description = 'Access to Batch Refunds';
     $batchRefund->save();
 }
开发者ID:shenlu2011,项目名称:internaltools,代码行数:65,代码来源:PermissionsSeeder.php


示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /**
      * Create four roles: admin, moderator, user and guest.
      */
     $admin = new Role();
     $admin->name = 'admin';
     $admin->display_name = 'Administrator';
     $admin->description = 'Super User Do';
     $admin->save();
     $moderator = new Role();
     $moderator->name = 'moderator';
     $moderator->display_name = 'Moderator';
     $moderator->description = 'Kan alle bestellingen zien en gebruikergegevens opvragen.';
     $moderator->save();
     $user = new Role();
     $user->name = 'user';
     $user->display_name = 'Gebruiker';
     $user->description = 'Standaard gebruiker. Kan bestellingen plaatsen en eigen gegevens inkijken.';
     $user->save();
     $guest = new Role();
     $guest->name = 'guest';
     $guest->display_name = 'Gast';
     $guest->description = 'Standaard gebruiker. Kan bestellingen plaatsen.';
     $guest->save();
     /**
      * Attach roles to users.
      */
     $adminUser = User::where('email', '=', '[email protected]')->first();
     $adminUser->attachRole($admin);
     $moderatorUser = User::where('email', '=', '[email protected]')->first();
     $moderatorUser->attachRole($moderator);
     $normalUser = User::where('email', '=', '[email protected]')->first();
     $normalUser->attachRole($user);
     $guestUser = User::where('email', '=', '[email protected]')->first();
     $guestUser->attachRole($guest);
     /**
      * Create permissions.
      */
     $createPage = new Permission();
     $createPage->name = 'create-page';
     $createPage->display_name = 'Create Pages';
     $createPage->description = 'create new pages';
     $createPage->save();
     $editPage = new Permission();
     $editPage->name = 'edit-page';
     $editPage->display_name = 'Edit Pages';
     $editPage->description = 'edit existing pages';
     $editPage->save();
     $editUser = new Permission();
     $editUser->name = 'edit-user';
     $editUser->display_name = 'Edit Users';
     $editUser->description = 'edit existing users';
     $editUser->save();
     /**
      * Attach permissions to roles.
      */
     $admin->attachPermissions(array($createPage, $editPage, $editUser));
     $moderator->attachPermissions(array($createPage, $editPage));
 }
开发者ID:sanderdekroon,项目名称:yourfoodbox,代码行数:65,代码来源:RolesAndPermissions.php


示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->insert(array(['id' => 1, 'name' => 'Admin', 'email' => '[email protected]', 'password' => Hash::make('admin'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()], ['id' => 2, 'name' => 'Member', 'email' => '[email protected]', 'password' => Hash::make('member'), 'created_at' => new DateTime(), 'updated_at' => new DateTime()]));
     $admin = new Role();
     $admin->name = 'admin';
     $admin->display_name = 'User Administrator';
     $admin->description = 'User is allowed to manage and edit other users';
     $admin->save();
     $member = new Role();
     $member->name = 'member';
     $member->display_name = 'Member';
     $member->description = 'User is a member';
     $member->save();
     $user = User::where('name', '=', 'Admin')->first();
     $user->attachRole($admin);
     $user = User::where('name', '=', 'Member')->first();
     $user->attachRole($member);
     $addLocal = new Permission();
     $addLocal->name = 'add-local';
     $addLocal->display_name = 'Add Local Site';
     $addLocal->description = 'add new local site';
     $addLocal->save();
     $viewContent = new Permission();
     $viewContent->name = 'view-content';
     $viewContent->display_name = 'View Content';
     $viewContent->description = 'view content in system';
     $viewContent->save();
     $admin->attachPermission($addLocal);
     $admin->attachPermission($viewContent);
     $member->attachPermission($viewContent);
 }
开发者ID:BooMamoo,项目名称:server,代码行数:36,代码来源:UserTableSeeder.php


示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     // Validate the forum
     $this->validate($request, ['name' => 'required|unique:forums|max:255', 'description' => 'required']);
     // Create a new Forum
     $forum = new Forum();
     $forum->name = $request->name;
     $forum->slug = str_slug($request->name, '-');
     $forum->description = $request->description;
     if ($forum->save()) {
         // Grant the admin access to the forum
         $admin = Role::find(1);
         // Admin should be created when built, shouldn't be an issue
         $accessForum = new Permission();
         $accessForum->name = 'access-forum-' . $forum->id;
         $accessForum->display_name = 'Access ' . $forum->name;
         // optional
         $accessForum->description = 'Ability to access and post in ' . $forum->name;
         // optional
         $accessForum->save();
         $admin->attachPermission($accessForum);
         Session::flash('alert-success', 'Forum created.');
     } else {
         Session::flash('alert-error', 'Could not create forum.');
     }
     return redirect('dashboard');
 }
开发者ID:unbolt,项目名称:imp,代码行数:33,代码来源:ForumController.php


示例5: run

 public function run()
 {
     $this->command->info('Roles data seeded!');
     $owner = new Role();
     $owner->name = 'owner';
     $owner->display_name = 'Owner';
     // optional
     $owner->description = 'Root';
     // optional
     $owner->save();
     $admin = new Role();
     $admin->name = 'admin';
     $admin->display_name = 'Administrator';
     // optional
     $admin->description = 'Administradores';
     // optional
     $admin->save();
     $this->command->info('Roles data attaching to users!');
     if ($owner) {
         $owner_user = User::where('name', '=', 'owner')->first();
         // role attach alias
         $owner_user->attachRole($owner);
         // parameter can be an Role object, array, or id
         $this->command->info('Owner role attached!');
     }
     if ($admin) {
         $admin_user = User::where('name', '=', 'ligacbb')->first();
         // role attach alias
         $admin_user->attachRole($admin);
         // parameter can be an Role object, array, or id
         $this->command->info('Admin role attached!');
     }
     $this->command->info('Creating Permissions!');
     $owner_permission = new Permission();
     $owner_permission->name = 'owner-permission';
     $owner_permission->display_name = 'Full control';
     // optional
     // Allow a user to...
     $owner_permission->description = '';
     // optional
     $owner_permission->save();
     $admin_permission = new Permission();
     $admin_permission->name = 'admin-permission';
     $admin_permission->display_name = 'Admin permission';
     // optional
     // Allow a user to...
     $admin_permission->description = '';
     // optional
     $admin_permission->save();
     $this->command->info('Attaching Owner Permission!');
     $owner->attachPermission($owner_permission);
     // equivalent to $admin->perms()->sync(array($owner_permission->id));
     $this->command->info('Attaching Admin Permission!');
     $admin->attachPermission($admin_permission);
     // equivalent to $owner->perms()->sync(array($createPost->id, $editUser->id));
 }
开发者ID:emitategh,项目名称:aabcehmt,代码行数:56,代码来源:RolesPermissionsSeeder.php


示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $superAdmin = new Role();
     $superAdmin->name = 'super admin';
     $superAdmin->display_name = 'Super admin';
     $superAdmin->description = 'This role holder has right to everything on the application.';
     $superAdmin->save();
     $authUser = new Role();
     $authUser->name = 'auth user';
     $authUser->display_name = 'Authenticated User';
     $authUser->description = 'This is the basic role which every registered user will get by default.';
     $authUser->save();
     /**
      * Manage Role Permissions
      */
     $manageRolePermission = new Permission();
     $manageRolePermission->name = 'manage-role-perm';
     $manageRolePermission->display_name = 'Manage Role & Permissions';
     $manageRolePermission->description = 'Manage roles and give permissions to role holders.';
     $manageRolePermission->save();
     $superAdmin->attachPermission($manageRolePermission);
     /**
      * Manage User Permission
      */
     $manageUserPermission = new Permission();
     $manageUserPermission->name = 'manage-users';
     $manageUserPermission->display_name = 'Manage Users';
     $manageUserPermission->description = 'Manage Users';
     $manageUserPermission->save();
     $superAdmin->attachPermission($manageUserPermission);
     /**
      * Manage Permission to see Activity
      */
     $manageActivityViewPermission = new Permission();
     $manageActivityViewPermission->name = 'view-activity';
     $manageActivityViewPermission->display_name = 'View Activity';
     $manageActivityViewPermission->description = 'View the different user activity in the system.';
     $manageActivityViewPermission->save();
     $superAdmin->attachPermission($manageActivityViewPermission);
     /**
      * Manage settings for application
      */
     $manageSettingsPermission = new Permission();
     $manageSettingsPermission->name = 'manage-settings';
     $manageSettingsPermission->display_name = 'Manage Settings';
     $manageSettingsPermission->description = 'Manage Settings for the application. User can change settings.';
     $manageSettingsPermission->save();
     $superAdmin->attachPermission($manageSettingsPermission);
     $user = User::create(['name' => 'Amitav Roy', 'email' => '[email protected]', 'password' => \Illuminate\Support\Facades\Hash::make('password'), 'first_name' => 'Amitav', 'last_name' => 'Roy', 'status' => 1]);
     $authUser = User::create(['name' => 'Jhon Doe', 'email' => '[email protected]', 'password' => \Illuminate\Support\Facades\Hash::make('password'), 'first_name' => 'Jhon', 'last_name' => 'Doe', 'status' => 1]);
     $authUser->attachRole($authUser);
     $user->attachRole($superAdmin);
 }
开发者ID:amitavroy,项目名称:mywall,代码行数:58,代码来源:UserTableSeeder.php


示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $sudo = new Permission();
     $sudo->name = 'sudo';
     $sudo->display_name = 'I can do everything';
     // optional
     $sudo->description = 'I can do everything';
     // optional
     $sudo->save();
     $listingBudget = new Permission();
     $listingBudget->name = 'listing-budget';
     $listingBudget->display_name = 'Listing Budget';
     // optional
     $listingBudget->description = 'Listing Budget';
     // optional
     $listingBudget->save();
     $creatingBudget = new Permission();
     $creatingBudget->name = 'creating-budget';
     $creatingBudget->display_name = 'Creating Budget';
     // optional
     $creatingBudget->description = 'Creating Budget';
     // optional
     $creatingBudget->save();
     $updatingBudget = new Permission();
     $updatingBudget->name = 'updating-budget';
     $updatingBudget->display_name = 'Updating Budget';
     // optional
     $updatingBudget->description = 'Updating Budget';
     // optional
     $updatingBudget->save();
     $deletingBudget = new Permission();
     $deletingBudget->name = 'deleting-budget';
     $deletingBudget->display_name = 'Deleting Budget';
     // optional
     $deletingBudget->description = 'Deleting Budget';
     // optional
     $deletingBudget->save();
     $makeTimeline = new Permission();
     $makeTimeline->name = 'make-timeline';
     $makeTimeline->display_name = 'Make Timeline';
     // optional
     $makeTimeline->description = 'Make Timeline';
     // optional
     $makeTimeline->save();
     $knowingTasks = new Permission();
     $knowingTasks->name = 'knowing-tasks';
     $knowingTasks->display_name = 'Knowing Tasks';
     // optional
     $knowingTasks->description = 'Knowing Tasks';
     // optional
     $knowingTasks->save();
 }
开发者ID:krisanalfa,项目名称:hisurugi,代码行数:57,代码来源:PermissionTableSeeder.php


示例8: updatePermissionStatus

 /**
  * Methods
  */
 public static function updatePermissionStatus($user_id, $resource, $actions)
 {
     $permission = Permission::where('user_id', $user_id)->where('resource', $resource)->first();
     if (!$permission) {
         $permissionData = array_merge(['user_id' => $user_id, 'resource' => $resource], $actions);
         $permission = new Permission($permissionData);
         $permission->save();
         return true;
     }
     foreach ($actions as $action => $status) {
         $permission->{$action} = $status;
     }
     $permission->save();
 }
开发者ID:postalu,项目名称:postal,代码行数:17,代码来源:Permission.php


示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     /*
      * Hey you! Yes, you there! TRY and keep this docblock up to date will ya pease? O:-)
     
         LIST OF PERMISSIONS
     
         - manager-users
         - manage-nominations - In place of "add-nominations"
         - add-nominations - In place of "manage-nominations"
         - access-reports
     */
     /* Admin -- Approve and Create an account */
     $manageUsers = new Permission();
     $manageUsers->name = "manage-users";
     $manageUsers->display_name = "Manage User Accounts";
     $manageUsers->description = "Create, edit, and approve users";
     $manageUsers->save();
     $manageNominations = new Permission();
     $manageNominations->name = "manage-nominations";
     $manageNominations->display_name = "Manage All Nominations";
     $manageNominations->description = "View, create, and edit all nominations";
     $manageNominations->save();
     $addNominations = new Permission();
     $addNominations->name = "add-nominations";
     $addNominations->display_name = "Add Nominations";
     $addNominations->description = "Add nominations from school";
     $addNominations->save();
     $accessReports = new Permission();
     $accessReports->name = "access-reports";
     $accessReports->display_name = "Access Reports";
     $accessReports->description = "Access reporting features";
     $accessReports->save();
     // PERMISSIONS BELOW ARE TBD.
     /*
      Volunteers -- May need updating
      - View shifts
      - Sign-up for shifts
     */
     /* Volunteer -- View Shifts */
     $viewShift = new Permission();
     $viewShift->name = "view-shift";
     $viewShift->display_name = "View available shifts";
     $viewShift->save();
     /* Volunteer - add shift */
     $addShift = new Permission();
     $addShift->name = "add-shift";
     $addShift->display_name = "Add shift to work schedule";
     $addShift->save();
 }
开发者ID:CodeForCharlotte,项目名称:cmpd-holiday-gift-backend,代码行数:55,代码来源:PermissionTableSeeder.php


示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     if ($request->user()->hasPermission('admin')) {
         $name = $request->input('name');
         $permission = new Permission();
         $permission->name = $request->input('name');
         if ($permission->save()) {
             return redirect('permissions')->withMessage('Permission saved successfully');
         } else {
             return redirect('permissions/create')->withErrors('Error during adding new permission');
         }
     } else {
         return redirect('/home')->withErrors('You do not have sufficient permissions');
     }
 }
开发者ID:scrx,项目名称:zt1,代码行数:21,代码来源:PermissionsController.php


示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $admin = new Role();
     $admin->name = "administrator";
     $admin->display_name = "Administrator";
     $admin->description = "An administrator gains access to everything.";
     $admin->power = 1000;
     $admin->save();
     $dashboardAccess = new Permission();
     $dashboardAccess->name = "dashboard.access";
     $dashboardAccess->display_name = "Dashboard access";
     $dashboardAccess->description = "Grant's a user access to the dashboard.";
     $dashboardAccess->save();
     $admin->attachPermission($dashboardAccess);
 }
开发者ID:Teamelite,项目名称:Dashboard,代码行数:20,代码来源:AccessControlSeeder.php


示例12: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('permissions')->truncate();
     Permission::create(['name' => 'can-create-request', 'display_name' => 'Can create request', 'description' => 'Allows the user to submit a new request']);
     Permission::create(['name' => 'can-approve-request', 'display_name' => 'Can approve request', 'description' => 'User can approve submitted requests']);
     Permission::create(['name' => 'can-admin', 'display_name' => 'Can Admin', 'description' => 'User can so anything']);
 }
开发者ID:gfdeveloper,项目名称:LCCB,代码行数:12,代码来源:PermissionsTableSeeder.php


示例13: removePermission

 public function removePermission($permission)
 {
     if (is_string($permission)) {
         $permission = Permission::where('name', $permission)->first();
     }
     return $this->permissions()->detach($permission);
 }
开发者ID:putridamayanti,项目名称:blog,代码行数:7,代码来源:Role.php


示例14: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function edit($id)
 {
     $role = Role::findOrFail($id);
     $permission_role = Role::find($id)->permissions()->lists('permission_id')->toArray();
     $permissions = Permission::lists('display_name', 'id');
     return view('admin.roles.edit', compact('role', 'permissions', 'permission_role'));
 }
开发者ID:wilderguzman,项目名称:lugrawibe,代码行数:14,代码来源:RolesController.php


示例15: run

 public function run()
 {
     // create roles
     $admin = Role::create(['name' => 'admin', 'display_name' => 'Admin', 'description' => 'performs administrative tasks', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $cashier = Role::create(['name' => 'cashier', 'display_name' => 'Cashier', 'description' => 'performs cashier tasks', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $user = Role::create(['name' => 'user', 'display_name' => 'Portal User', 'description' => 'performs all basic tasks like print receipt, etc...', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     // create permissions
     $editUser = Permission::create(['name' => 'edit-user', 'display_name' => 'Edit Users', 'description' => 'manage users', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $reporting = Permission::create(['name' => 'reporting', 'display_name' => 'Print Report, Print receipt', 'description' => 'manage reports', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $editReporting = Permission::create(['name' => 'edit-reporting', 'display_name' => 'Edit Report, Edit receipt', 'description' => 'manage reports', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $receipt = Permission::create(['name' => 'view-receipt', 'display_name' => 'View receipt, View Billings', 'description' => 'View recipent and view billings', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     // assign permissions to roles
     $admin->attachPermissions(array($editUser, $reporting, $receipt, $editReporting));
     $cashier->attachPermissions(array($reporting, $receipt, $editReporting));
     $user->attachPermissions(array($reporting, $receipt));
     // attach admin user to admin role
     $userAdmin = User::where('email', env('ADMIN_EMAIL'))->firstOrFail();
     $userAdmin->attachRole($admin);
     // assign default role to users
     $users = User::all();
     foreach ($users as $normalUser) {
         if ($normalUser->hasRole('user')) {
             continue;
         }
         $normalUser->attachRole($user);
     }
 }
开发者ID:encry2024,项目名称:soa_5,代码行数:27,代码来源:RolesAndPermissionsSeeder.php


示例16: run

 public function run()
 {
     $this->command->info('Seeding permission to role associations.');
     $permissions = Permission::get()->modelKeys();
     // Insert default permissions.
     foreach ($this->slugs() as $role_id => $slugs) {
         foreach ($slugs as $slug_key => $slug_value) {
             if (!is_numeric($slug_key) && (is_numeric($slug_value) || is_bool($slug_value))) {
                 $permission_id = $slug_key;
                 $permission_value = !!$slug_value;
             } else {
                 $permission_id = $slug_value;
                 $permission_value = true;
             }
             if (in_array($permission_id, $permissions)) {
                 RolePermission::firstOrCreate(['role_id' => $role_id, 'permission_id' => $permission_id, 'value' => $permission_value]);
             } else {
                 $this->command->error("Attempting to assign non-existant permission id `{$permission_id}` to role_id `{$role_id}`.");
             }
         }
     }
     // Give admin permissions.
     if (count($permissions)) {
         foreach ($permissions as $permission_id) {
             $permission = RolePermission::firstOrNew(['role_id' => Role::ID_ADMIN, 'permission_id' => $permission_id]);
             $permission->value = 1;
             $permission->save();
         }
     }
 }
开发者ID:Cipherwraith,项目名称:infinity-next,代码行数:30,代码来源:RoleSeeder.php


示例17: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Admin
     $admin = User::where(['email' => '[email protected]'])->first();
     $adminRole = Role::where(['name' => 'admin'])->first();
     $adminPermission = Permission::where(['name' => 'sudo'])->first();
     $admin->attachRole($adminRole);
     $adminRole->attachPermission($adminPermission);
     // PM
     $projectManager = User::where(['email' => '[email protected]'])->first();
     $projectManagerRole = Role::where(['name' => 'project-manager'])->first();
     $projectManagerPermission = Permission::where(['name' => 'listing-budget'])->first();
     $projectManager->attachRole($projectManagerRole);
     $projectManagerRole->attachPermission($projectManagerPermission);
     // Team Leader
     $teamLeader = User::where(['email' => '[email protected]'])->first();
     $teamLeaderRole = Role::where(['name' => 'team-leader'])->first();
     $teamLeaderPermission = Permission::where(['name' => 'make-timeline'])->first();
     $teamLeader->attachRole($teamLeaderRole);
     $teamLeaderRole->attachPermission($teamLeaderPermission);
     // Programmer
     $programmer = User::where(['email' => '[email protected]'])->first();
     $programmerRole = Role::where(['name' => 'programmer'])->first();
     $programmerPermission = Permission::where(['name' => 'knowing-tasks'])->first();
     $programmer->attachRole($programmerRole);
     $programmerRole->attachPermission($programmerPermission);
 }
开发者ID:krisanalfa,项目名称:hisurugi,代码行数:32,代码来源:UserRoleAssignmentSeeder.php


示例18: postStudent

 public function postStudent(StudentRequest $request)
 {
     $user = new User();
     $user->username = $request->txtten;
     $user->password = Hash::make($request->txtten);
     $user->name = $request->txtten;
     $user->save();
     $user_id = $user->id;
     $permission = Permission::where('slug', 'student')->get()->first();
     $permissionUser = new PermissionUser();
     $permissionUser->permission_id = $permission->id;
     $permissionUser->user_id = $user_id;
     $permissionUser->save();
     $student = new ThiSinh();
     $student->ten = $request->txtten;
     $student->gioitinh = $request->sltGt;
     $student->namsinh = $request->txtns;
     $student->quequan = $request->txtqq;
     $student->khuvuc = $request->txtkv;
     $student->user_id = $user_id;
     $student->save();
     $thisinh_id = $student->id;
     $point = new Diem();
     $point->sbd = $request->txtsbd;
     $point->mon1 = 0;
     $point->mon2 = 0;
     $point->mon3 = 0;
     $point->khoi = $request->txtkt;
     $point->thisinh_id = $thisinh_id;
     $point->save();
     return redirect()->route('cluster-staff.quan-ly-thong-tin-thi-sinh.listStudent')->with(['flash_level' => 'success', 'flash_message' => 'Success!!! Complete Add Student']);
 }
开发者ID:vjtc0n,项目名称:project,代码行数:32,代码来源:ClusterStaffController.php


示例19: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Role::create(['name' => 'manager_receive', 'label' => 'Manager of Receive.']);
     Role::create(['name' => 'manager_requesition', 'label' => 'Manager of Requesition.']);
     Role::create(['name' => 'manager_product_list', 'label' => 'Manager of Product list.']);
     Role::create(['name' => 'manager_product', 'label' => 'Manager of Product.']);
     Role::create(['name' => 'manager_product_type', 'label' => 'Manager of Product Type.']);
     Role::create(['name' => 'manager_unit', 'label' => 'Manager of Unit.']);
     Role::create(['name' => 'manager_location', 'label' => 'Manager of Location.']);
     Role::create(['name' => 'manager_project', 'label' => 'Manager of Project.']);
     Role::create(['name' => 'manager_user', 'label' => 'Manager of User.']);
     Permission::create(['name' => 'create_form', 'label' => 'Create of form.']);
     Permission::create(['name' => 'update_form', 'label' => 'Update of form.']);
     Permission::create(['name' => 'delete_form', 'label' => 'Delete of form.']);
     $roles = Role::all();
     $permissions = Permission::all();
     foreach ($roles as $role) {
         foreach ($permissions as $permission) {
             $role->givePermissionTo($permission);
         }
     }
     $user = User::whereEmail('[email protected]')->first();
     foreach ($roles as $role) {
         $user->assignRole($role->name);
     }
     $user = User::whereEmail('[email protected]')->first();
     foreach ($roles as $role) {
         $user->assignRole($role->name);
     }
 }
开发者ID:vasitjuntong,项目名称:mixed,代码行数:35,代码来源:RolesSeeder.php


示例20: addPermission

 /**
  * Add a Permission to a Role
  *
  * @param mixed $permission Permission to add, might by instance of Permission or name of permission as string
  * @return Illuminate\Database\Eloquent\Model
  */
 public function addPermission($permission)
 {
     if (is_string($permission)) {
         $permission = Permission::whereName($permission)->firstOrFail();
     }
     return $this->permissions()->save($permission);
 }
开发者ID:guenthertheilen,项目名称:laravel-boilerplate,代码行数:13,代码来源:Role.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP app\Photo类代码示例发布时间:2022-05-23
下一篇:
PHP app\Page类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap