当前位置: 首页>>代码示例>>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;未经允许,请勿转载。