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


PHP Model::unguard方法代碼示例

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


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement("SET foreign_key_checks = 0");
     DB::table('roles')->truncate();
     DB::table('role_user')->truncate();
     DB::table('users')->truncate();
     DB::table('berita')->truncate();
     DB::table('kontak')->truncate();
     $this->call(UserTableSeeder::class);
     $this->call(BeritaTableSeeder::class);
     $this->call(KontakTableSeeder::class);
     $admin = App\User::find(1);
     $admin->attachRole(1);
     $mahasiswa = App\User::find(2);
     $mahasiswa->attachRole(2);
     $akademik = App\User::find(3);
     $akademik->attachRole(3);
     $rektor = App\User::find(4);
     $rektor->attachRole(4);
     $dekan = App\User::find(5);
     $dekan->attachRole(5);
     $kemahasiswaan = App\User::find(6);
     $kemahasiswaan->attachRole(6);
     $prodi = App\User::find(7);
     $prodi->attachRole(7);
     Model::reguard();
 }
開發者ID:rikoansh,項目名稱:Master,代碼行數:33,代碼來源:DatabaseSeeder.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     /**
      * Disable foreign key checks for this
      * connection before running seeders.
      */
     DB::statement('SET FOREIGN_KEY_CHECKS = 0;');
     $this->call('AlertsTableSeeder');
     $this->call('CheckCategoriesTableSeeder');
     $this->call('ChecksTableSeeder');
     $this->call('CheckResultsTableSeeder');
     $this->call('DatabaseTechnologiesTableSeeder');
     $this->call('EnvironmentsTableSeeder');
     $this->call('OperatingSystemsTableSeeder');
     $this->call('ReportLevelsTableSeeder');
     $this->call('ReportTypesTableSeeder');
     $this->call('TicketCategoriesTableSeeder');
     $this->call('TicketPrioritiesTableSeeder');
     $this->call('TicketTypesTableSeeder');
     /**
      * Will not seed clients, services, servers, and server check
      * results if this is the production environment.
      */
     if (getenv('APP_ENV') !== 'production') {
         $this->call('ClientsTableSeeder');
         $this->call('ServicesTableSeeder');
         $this->call('SitesTableSeeder');
         $this->call('ServersTableSeeder');
         $this->call('ServerCheckResultsTableSeeder');
     }
     // Reset foreign key checks.
     DB::statement('SET FOREIGN_KEY_CHECKS = 1;');
 }
開發者ID:ngaitanis,項目名稱:dodona-dev,代碼行數:39,代碼來源:DatabaseSeeder.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call('UserTableSeeder');
     $this->call('UsersSeeder');
     Model::reguard();
 }
開發者ID:bigazzzz,項目名稱:Laravel-test,代碼行數:12,代碼來源:DatabaseSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     factory('App\\User', 100)->create();
     Model::reguard();
     // $this->call(UserTableSeeder::class);
 }
開發者ID:jorgenaranjo,項目名稱:crudAngularLaravel,代碼行數:12,代碼來源:DatabaseSeeder.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     $this->call(SudoAdminUser::class);
     Model::reguard();
 }
開發者ID:richardblondet,項目名稱:tribu,代碼行數:12,代碼來源:DatabaseSeeder.php

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $this->call(CountriesSeeder::class);
     $this->call(UsersSeeder::class);
     Model::reguard();
 }
開發者ID:nikdiklic,項目名稱:laravel-angular-todo-list,代碼行數:12,代碼來源:DatabaseSeeder.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     //Sermon seeding
     $this->call('SermonSeeder');
     $this->command->info('Sermons table seeded!');
     // Users seeding
     DB::table('users')->delete();
     DB::table('password_reminders')->delete();
     DB::table('permission_role')->delete();
     DB::table('assigned_roles')->delete();
     DB::table('roles')->delete();
     DB::table('permissions')->delete();
     $this->call('PermissionSeeder');
     $this->command->info('Permissions table seeded!');
     $this->call('RoleSeeder');
     $this->command->info('Roles tables seeded!');
     $this->call('UserSeeder');
     $this->command->info('Users tables seeded!');
     // Pages seeding
     // !!Do not use, as there is no way of seeding the pages table!!
     //$this->call('PageSeeder');
     //$this->command->info('Pages table seeded!');
     // Document seeding
     $this->call('DocumentSeeder');
     $this->command->info('Documents table seeded!');
 }
開發者ID:GarethClarridge,項目名稱:crockenhill,代碼行數:32,代碼來源:DatabaseSeeder.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     DB::table('users')->insert(['email' => str_random(10) . '@gmail.com', 'name' => str_random(10), 'lastname' => str_random(10), 'password' => bcrypt('secret')]);
     Model::reguard();
 }
開發者ID:edyman,項目名稱:laravel,代碼行數:12,代碼來源:DatabaseSeeder.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $this->call(ApplicationSeeder::class);
     $this->call(ActorSeeder::class);
     Model::reguard();
 }
開發者ID:diogofrancoweb,項目名稱:use-case-management,代碼行數:12,代碼來源:ApiTableSeeder.php

示例10: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $this->cleanDatabase();
     Model::unguard();
     $this->call('UserTableSeeder');
     Model::reguard();
 }
開發者ID:jamesvillarrubia,項目名稱:tpp,代碼行數:12,代碼來源:DatabaseSeeder.php

示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $this->call(CreateUsersSeeder::class);
     $this->call(CreateEverythingSeeder::class);
     Model::reguard();
 }
開發者ID:devktp,項目名稱:hackathon,代碼行數:12,代碼來源:DatabaseSeeder.php

示例12: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $this->call(UserSeeder::class);
     $this->call(InterestsTableSeeder::class);
     Model::reguard();
 }
開發者ID:hack-mnl,項目名稱:enjoin,代碼行數:12,代碼來源:DatabaseSeeder.php

示例13: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     $this->call(user::class);
     $this->call(article::class);
 }
開發者ID:nghesilangthang,項目名稱:tutorial_blog_laravel5,代碼行數:12,代碼來源:DatabaseSeeder.php

示例14: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $this->call('CategoriesTableSeeder');
     $this->call('BlogsTableSeeder');
     // $this->call('UserTableSeeder');
 }
開發者ID:lamwin,項目名稱:laravel-blog,代碼行數:12,代碼來源:DatabaseSeeder.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (User::count()) {
         return;
     }
     User::whereNotNull('id')->delete();
     Model::unguard();
     $users = User::all();
     $users = [['id' => 1, 'name' => 'محسن بخيش', 'email' => 'mbakhick@css.edu.om', 'password' => bcrypt("123456")], ['name' => 'هيثم', 'email' => 'haitham.hamdy@css.edu.om ', 'password' => bcrypt("123456")], ['name' => 'سامي', 'email' => 'samialmamari@css.edu.om ', 'password' => bcrypt("123456")], ['name' => 'احمد', 'email' => 'aalkindi@css.edu.om ', 'password' => bcrypt("123456")]];
     foreach ($users as $user) {
         User::create($user);
     }
     $permissions = [['module' => 'users', 'name' => 'اضافة مستخدم', 'slug' => 'create.users'], ['module' => 'users', 'name' => 'حذف مستخدم', 'slug' => 'delete.users'], ['module' => 'users', 'name' => 'تعديل مستخدم', 'slug' => 'edit.users'], ['module' => 'users', 'name' => 'مشاهدة المستخدمين', 'slug' => 'view.users'], ['module' => 'users', 'name' => 'اضافة صلاحية', 'slug' => 'create.roles'], ['module' => 'users', 'name' => 'حذف صلاحية', 'slug' => 'delete.roles'], ['module' => 'users', 'name' => 'تعديل صلاحية', 'slug' => 'edit.roles'], ['module' => 'users', 'name' => 'مشاهدة الصلاحيات', 'slug' => 'view.roles']];
     $slugs = array_map(function ($ar) {
         return $ar['slug'];
     }, $permissions);
     $users = User::all();
     Permission::whereIn('slug', $slugs)->delete();
     foreach ($permissions as $permission) {
         $perm = Permission::create($permission);
         foreach ($users as $user) {
             $user->attachPermission($perm);
         }
     }
 }
開發者ID:hisambahaa,項目名稱:DARES,代碼行數:30,代碼來源:UsersTableSeeder.php


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