当前位置: 首页>>代码示例>>PHP>>正文


PHP User::truncate方法代码示例

本文整理汇总了PHP中app\User::truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP User::truncate方法的具体用法?PHP User::truncate怎么用?PHP User::truncate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\User的用法示例。


在下文中一共展示了User::truncate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $owners = [['email' => 'admin@email.com', 'password' => bcrypt('admin')]];
     User::truncate();
     foreach ($owners as $owner) {
         $user = User::create($owner);
         $user->roles()->attach(Role::where('name', 'owner')->firstOrFail());
         $user->save();
     }
 }
开发者ID:Virgeto,项目名称:GG-enginering-backend,代码行数:15,代码来源:OwnerSeeder.php

示例2: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     User::truncate();
     DB::table('payee_payer')->truncate();
     $jenny = User::create(['name' => 'Jenny', 'email' => 'cheezyspaghetti@gmail.com', 'password' => bcrypt('abcdefg')]);
     $jane = User::create(['name' => 'Jane', 'email' => 'jane@someplace.com', 'password' => bcrypt('abcdefg')]);
     $bob = User::create(['name' => 'Bob', 'email' => 'bob@someplace.com', 'password' => bcrypt('abcdefg')]);
     $john = User::create(['name' => 'John', 'email' => 'cheezyspaghetti@optusnet.com.au', 'password' => bcrypt('abcdefg')]);
     /**
      * Create payers for John
      */
     $payee_john = Payee::find($john->id);
     $payee_john->payers()->attach($jenny->id);
     $payee_john->payers()->attach($jane->id);
     $payee_john->payers()->attach($bob->id);
     $payee_john->save();
     /**
      * Create payers for Bob
      */
     $payee_bob = Payee::find($bob->id);
     $payee_bob->payers()->attach($jenny->id);
     $payee_bob->payers()->attach($john->id);
     $payee_bob->save();
     /**
      * Create payers for Jenny
      */
     $payee_bob = Payee::find($bob->id);
     $payee_bob->payers()->attach($john->id);
     $payee_bob->save();
 }
开发者ID:JennySwift,项目名称:project-tracker,代码行数:35,代码来源:UserSeeder.php

示例3: run

    public function run()
    {	
      User::truncate();
			User::create(['name' => 'Deepak',
        			'email' => 'deepak@yahoo.com',
       				'password' => 'deepak',
       				'role_id' => '1']);
			User::create(['name' => 'Monsoor',
        			'email' => 'monsoorch@gmail.com',
       				'password' => 'monsoorch',
       				'role_id' => '2']);
			User::create(['name' => 'Suraj',
        			'email' => 'sacontrack@gmail.com',
       				'password' => 'sactrack',
       				'role_id' => '3']);
			User::create(['name' => 'Saidul',
        			'email' => 'saidul.a.ch@gmail.com',
       				'password' => '123456',
       				'role_id' => '4']);
			User::create(['name' => 'Raihan',
        			'email' => 'raihan25@gmail.com',
       				'password' => '321654',
       				'role_id' => '5']);

	}
开发者ID:surajch,项目名称:ensue-me,代码行数:25,代码来源:UserTableSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // clear table
     User::truncate();
     // add 1st row
     User::create(['name' => 'Anna', 'email' => 'tien.nguyen@mulodo.com', 'password' => '$2y$10$qQdDaXWbo4itF/B12I7KgOIkLBgMuA9O3xup1VoN1vwv69YF2P1Ga']);
 }
开发者ID:vytien,项目名称:laravel-5,代码行数:12,代码来源:UsersSeeder.php

示例5: run

 /**
  * Run the database seeds.
  *
  * @return  void
  */
 public function run()
 {
     Tag::truncate();
     User::truncate();
     Bookmark::truncate();
     DB::table('bookmark_tag')->truncate();
     // Start with 10 users, then iterate through each one to populate the other tables
     $users = factory(App\User::class, 50)->create();
     $users->each(function ($user) {
         // Create a variable number of bookmarks/tags and persist them to the DB.
         // saveMany() automatically associates them with the current user_id.
         $bookmarks = factory(App\Bookmark::class, rand(2, 5))->make();
         $user->bookmarks()->saveMany($bookmarks);
         $tags = factory(App\Tag::class, rand(2, 5))->make();
         $user->tags()->saveMany($tags);
         // Everything is populated now except the bookmark_tag pivot table.
         // For that we need another loop.
         $tags->each(function ($tag) use($bookmarks) {
             for ($i = 0; $i < rand(1, 3); $i++) {
                 // Select a random bookmark from the $bookmarks collection,
                 // then attach the tag only IF the tag has not already been attached
                 // to that bookmark.
                 $bookmark = $bookmarks[rand(0, $bookmarks->count() - 1)];
                 if (!$bookmark->tags()->where('tag_id', $tag->id)->exists()) {
                     $bookmark->tags()->attach($tag);
                 }
             }
         });
     });
 }
开发者ID:nickdunn2,项目名称:bocket,代码行数:35,代码来源:DatabaseSeeder.php

示例6: run

 public function run()
 {
     // clear table
     User::truncate();
     // add 1st user
     User::create(['name' => 'Hilmy Syarif', 'email' => 'hilmysyarif@gmail.com', 'password' => bcrypt('benjo99')]);
 }
开发者ID:hilmysyarif,项目名称:sic,代码行数:7,代码来源:UserTableSeeder.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //Truncate
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     User::truncate();
     Admin::truncate();
     Customer::truncate();
     Address::truncate();
     Category::truncate();
     Product::truncate();
     Brand::truncate();
     Type::truncate();
     Image::truncate();
     DB::statement('TRUNCATE category_product;');
     Product::clearIndices();
     Product::reindex();
     //Unguard
     Model::unguard();
     //Call
     $this->call(UsersTableSeeder::class);
     $this->call(ProductsTableSeeder::class);
     //Reguard
     Model::reguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
开发者ID:jentleyow,项目名称:megadeal,代码行数:30,代码来源:DatabaseSeeder.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $this->call('FabricanteSeeder');
     $this->call('VehiculoSeeder');
     User::truncate();
     $this->call('UserSeeder');
 }
开发者ID:vicogh,项目名称:RESTful,代码行数:12,代码来源:DatabaseSeeder.php

示例9: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     User::truncate();
     factory(User::class, 50)->create();
     Model::reguard();
 }
开发者ID:najibu,项目名称:learning-laravel-5,代码行数:12,代码来源:DatabaseSeeder.php

示例10: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Aluno::truncate();
     User::truncate();
     Model::unguard();
     $this->call('UserTableSeeder');
     $this->call('AlunoTableSeeder');
 }
开发者ID:GabrielDvt,项目名称:Carteirinha,代码行数:13,代码来源:DatabaseSeeder.php

示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     User::truncate();
     factory(App\User::class, 50)->create();
     Model::reguard();
 }
开发者ID:ken4ward,项目名称:SchoolProject,代码行数:13,代码来源:DatabaseSeeder.php

示例12: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \App\User::truncate();
     //Usuario de teste
     factory('App\\User')->create(['name' => 'Beto', 'email' => 'beto@email.com', 'password' => bcrypt(123), 'remember_token' => str_random(10)]);
     factory(User::class, 5)->create();
     // o codigo User::class e o mesmo que 'App\User', recurso do php 5
 }
开发者ID:albertosveloso,项目名称:tarefas-laravel51,代码行数:13,代码来源:UserTableSeeder.php

示例13: userTable

 /**
  * заполнение пользователей
  */
 private function userTable()
 {
     User::truncate();
     $data = [['name' => 'user1', 'password' => \Hash::make('user1'), 'email' => 'user1@mail.ru', 'group_id' => 2], ['name' => 'user2', 'password' => \Hash::make('user2'), 'email' => 'user2@mail.ru', 'group_id' => 2], ['name' => 'admin', 'password' => \Hash::make('admin'), 'email' => 'admin@mail.ru', 'group_id' => 1]];
     foreach ($data as $v) {
         User::create($v);
     }
 }
开发者ID:avil13,项目名称:test_card,代码行数:11,代码来源:DatabaseSeeder.php

示例14: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     User::truncate();
     User::create(['rol_id' => 1, 'nombre' => 'Administrador', 'email' => 'Admin', 'password' => Hash::make('123456')]);
     User::create(['rol_id' => 2, 'nombre' => 'rrhh', 'email' => 'RRHH', 'password' => Hash::make('123456')]);
     User::create(['rol_id' => 3, 'nombre' => 'trabajador1', 'email' => 'Trabajador1', 'password' => Hash::make('123456')]);
 }
开发者ID:AlexanderZon,项目名称:proyecto_crister,代码行数:13,代码来源:UsersTableSeeder.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement("SET foreign_key_checks = 0");
     User::truncate();
     DB::statement("SET foreign_key_checks = 1");
     User::create(['user_name' => 'frodo', 'user_email' => 'xyz@example.com', 'password' => bcrypt('112233')]);
     User::create(['user_name' => 'bilbo', 'user_email' => 'abc@example.com', 'password' => bcrypt('112233'), 'is_user_ngo' => 1]);
 }
开发者ID:umarhussain15,项目名称:web_semester_project_integration_repo_Jan16,代码行数:13,代码来源:UserTableSeeder.php


注:本文中的app\User::truncate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。