本文整理汇总了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();
}
示例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;');
}
示例3: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call('UserTableSeeder');
$this->call('UsersSeeder');
Model::reguard();
}
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
factory('App\\User', 100)->create();
Model::reguard();
// $this->call(UserTableSeeder::class);
}
示例5: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call(UserTableSeeder::class);
$this->call(SudoAdminUser::class);
Model::reguard();
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call(CountriesSeeder::class);
$this->call(UsersSeeder::class);
Model::reguard();
}
示例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!');
}
示例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();
}
示例9: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call(ApplicationSeeder::class);
$this->call(ActorSeeder::class);
Model::reguard();
}
示例10: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$this->cleanDatabase();
Model::unguard();
$this->call('UserTableSeeder');
Model::reguard();
}
示例11: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call(CreateUsersSeeder::class);
$this->call(CreateEverythingSeeder::class);
Model::reguard();
}
示例12: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call(UserSeeder::class);
$this->call(InterestsTableSeeder::class);
Model::reguard();
}
示例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);
}
示例14: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->call('CategoriesTableSeeder');
$this->call('BlogsTableSeeder');
// $this->call('UserTableSeeder');
}
示例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);
}
}
}