當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Permission::truncate方法代碼示例

本文整理匯總了PHP中app\models\Permission::truncate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Permission::truncate方法的具體用法?PHP Permission::truncate怎麽用?PHP Permission::truncate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Permission的用法示例。


在下文中一共展示了Permission::truncate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0');
     User::truncate();
     Role::truncate();
     Permission::truncate();
     DB::statement('SET FOREIGN_KEY_CHECKS=1');
     Model::unguard();
     $this->call(UserTableSeeder::class);
     $this->call(RolesTableSeeder::class);
     $this->call(PermissionsTableSeeder::class);
     Model::reguard();
 }
開發者ID:viethung09,項目名稱:trinity,代碼行數:18,代碼來源:DatabaseSeeder.php

示例2: run

 public function run()
 {
     Permission::truncate();
     Permission::create(['name' => 'login-web', 'permission' => 'Login to Web', 'description' => 'Allow user to log in via web.', 'is_default' => 1, 'is_readonly' => 1]);
     Permission::create(['name' => 'login-api', 'permission' => 'Login via API', 'description' => 'Allow user to log in via API.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'edit-profile-web', 'permission' => 'Edit Profile via web', 'description' => 'Allow user to edit profile via web.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'edit-profile-api', 'permission' => 'Edit Profile via API', 'description' => 'Allow user to edit profile via API.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'system-info', 'permission' => 'View System Information', 'description' => 'View system information.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'user-list', 'permission' => 'List Users', 'description' => 'List users.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'user-info', 'permission' => 'View User Info', 'description' => 'View user information.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'user-add', 'permission' => 'Add User', 'description' => 'Add user.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'user-edit', 'permission' => 'Edit User', 'description' => 'Edit user.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'user-delete', 'permission' => 'Delete User', 'description' => 'Delete user.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'role-list', 'permission' => 'List Roles', 'description' => 'List roles.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'role-info', 'permission' => 'View Role Info', 'description' => 'View role information.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'role-add', 'permission' => 'Add Role', 'description' => 'Add role.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'role-edit', 'permission' => 'Edit Role', 'description' => 'Edit role.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'role-delete', 'permission' => 'Delete Role', 'description' => 'Delete role.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'permission-list', 'permission' => 'List Permissions', 'description' => 'List permissions.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'permission-info', 'permission' => 'View Permission Info', 'description' => 'View permission information.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'permission-add', 'permission' => 'Add Permission', 'description' => 'Add permission.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'permission-edit', 'permission' => 'Edit Permission', 'description' => 'Edit permission.', 'is_default' => 0, 'is_readonly' => 1]);
     Permission::create(['name' => 'permission-delete', 'permission' => 'Delete Permission', 'description' => 'Delete permission.', 'is_default' => 0, 'is_readonly' => 1]);
 }
開發者ID:nuwira,項目名稱:tunggorono,代碼行數:24,代碼來源:PermissionTableSeeder.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Permission::truncate();
     $permissions = ["view_lecturer", "create_lecturer", "edit_lecturer", "delete_lecturer", "view_student", "create_student", "edit_student", "delete_student", "edit_profile", "view_profile", "view_user", "create_user", "edit_user", "delete_user", "view_university", "create_university", "edit_university", "delete_university", "view_sos_request", "create_sos_request", "edit_sos_request", "delete_sos_request"];
     $names = ["View Lecturer", "Create Lecturer", "Edit Lecturer", "Delete Lecturer", "View Student", "Create Student", "Edit Student", "Delete Student", "Edit Profile", "View Profile", "View User", "Create User", "Edit User", "Delete User", "View University", "Create University", "Edit University", "Delete University", "View SOS Request", "Create SOS Request", "Edit SOS Request", "Delete SOS Request"];
     for ($i = 0; $i < count($permissions); $i++) {
         $r = Permission::create(['name' => $names[$i], 'permission' => $permissions[$i]]);
     }
 }
開發者ID:joaonzangoII,項目名稱:find_my_campuses_friend,代碼行數:14,代碼來源:DatabaseSeeder.php


注:本文中的app\models\Permission::truncate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。