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


PHP Role::truncate方法代碼示例

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


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

示例1: run

    public function run()
    {		    Role::truncate();
				Role::create(['role_type' => 'admin']);
				Role::create(['role_type' => 'user']);
				Role::create(['role_type' => 'guest']);
				Role::create(['role_type' => 'admin']);
				Role::create(['role_type' => 'guest']);
	}
開發者ID:surajch,項目名稱:ensue-me,代碼行數:8,代碼來源:RoleTableSeeder.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Role::truncate();
     $roles = [1 => ['admin', 'admin.description'], 1 => ['moderator', 'moderator.description'], 2 => ['subscriber', 'subscriber.description']];
     foreach ($roles as $k => $v) {
         Role::create(['id' => $k, 'name' => $v[0], 'description' => $v[1]]);
     }
 }
開發者ID:avil13,項目名稱:lab.friends,代碼行數:13,代碼來源:RolesSeeder.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $roles = [['name' => 'owner'], ['name' => 'administrator'], ['name' => 'member']];
     Role::truncate();
     foreach ($roles as $role) {
         Role::create($role);
     }
 }
開發者ID:Virgeto,項目名稱:GG-enginering-backend,代碼行數:13,代碼來源:RoleSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     User::truncate();
     Role::truncate();
     Permission::truncate();
     DB::table('permission_role')->truncate();
     DB::table('role_user')->truncate();
     $userAdmin = User::create(['name' => 'Admin', 'email' => 'admin@laravel.com', 'password' => Hash::make('password')]);
     $roleAdmin = Role::create(['name' => 'admin']);
     $roleEditor = Role::create(['name' => 'editor']);
     $roleContributor = Role::create(['name' => 'contributor']);
     $postCreatePermission = Permission::create(['name' => 'post/create']);
     $userAdmin->roles()->sync([$roleAdmin->id, $roleEditor->id, $roleContributor->id]);
     $roleContributor->permissions()->save($postCreatePermission);
 }
開發者ID:roncloud07,項目名稱:laravel-role,代碼行數:20,代碼來源:UserRolePermissionSeeder.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     DomainController::truncate();
     Trust::truncate();
     Site::truncate();
     Role::truncate();
     Permission::truncate();
     Module::truncate();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
     Model::unguard();
     $this->call('DomainControllersTableSeeder');
     $this->call('TrustsTableSeeder');
     $this->call('SitesTableSeeder');
     $this->call('RolesTableSeeder');
     $this->call('ModulesTableSeeder');
     $this->call('PermissionsTableSeeder');
 }
開發者ID:jasonb8293,項目名稱:fox-api,代碼行數:23,代碼來源:DatabaseSeeder.php

示例6: run

 /**
  *
  */
 public function run()
 {
     Role::truncate();
     $data = [["name" => "Admin"], ["name" => "Customer"]];
     Role::insert($data);
 }
開發者ID:laraviet,項目名稱:catalog,代碼行數:9,代碼來源:RoleTableSeeder.php

示例7: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Role::truncate();
 }
開發者ID:GCRS,項目名稱:special-journey,代碼行數:9,代碼來源:2016_01_31_080608_add_default_roles.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Role::truncate();
     $data = [['name' => 'admin'], ['name' => 'staf'], ['name' => 'member']];
     Role::insert($data);
 }
開發者ID:louisthaihv,項目名稱:colong,代碼行數:11,代碼來源:RoleTableSeeder.php


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