예제 #1
1
 public function run()
 {
     $faker = Faker::create();
     //$table = 'lalalal';
     //$this->command->getOutput()->writeln("<info>product table seeder table</info> $table");
     DB::table('products')->delete();
     DB::unprepared('alter table products auto_increment = 1');
     for ($i = 1; $i <= env('MaxProductsSeeds'); $i++) {
         Product::create(['name' => $faker->word, 'price' => $faker->randomFloat(), 'browsed' => $faker->boolean()]);
     }
 }
 /**
  * Run the users seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('organizations')->delete();
     $statement = "ALTER TABLE organizations AUTO_INCREMENT = 1;";
     DB::unprepared($statement);
     Organization::create(['uuid' => uniqid(), 'name' => 'Gorilla LTD', 'address' => '61 cours du médoc', 'address_comp' => 'appt 22 bat B', 'user_id' => 1]);
 }
 /**
  * Run the users seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     $statement = "ALTER TABLE users AUTO_INCREMENT = 1;";
     DB::unprepared($statement);
     User::create(['id' => 1, 'email' => '*****@*****.**', 'password' => bcrypt('123123'), 'organization_id' => 1]);
     User::create(['id' => 2, 'email' => '*****@*****.**', 'password' => bcrypt('123123'), 'organization_id' => 1]);
     User::create(['id' => 3, 'email' => '*****@*****.**', 'password' => bcrypt('123123'), 'organization_id' => 1]);
 }
 /**
  * Run the users seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users_profiles')->delete();
     $statement = "ALTER TABLE users_profiles AUTO_INCREMENT = 1;";
     DB::unprepared($statement);
     UserProfile::create(['firstname' => 'Alexandre', 'lastname' => 'Mangin', 'phone' => '0616391876', 'user_id' => 1]);
     UserProfile::create(['firstname' => 'Alan', 'lastname' => 'Corbel', 'phone' => '0626381876', 'user_id' => 2]);
     UserProfile::create(['firstname' => 'Christophe', 'lastname' => 'Larquey', 'phone' => '0605040302', 'user_id' => 3]);
 }
예제 #5
0
 public function run()
 {
     $admin = array('displayName' => 'Andres Rangel', 'email' => '*****@*****.**', 'password' => bcrypt('12345'), 'active' => 1, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s"), 'image' => '55fa8e7a612e4.png');
     $user = array('displayName' => 'User Andres', 'email' => '*****@*****.**', 'password' => bcrypt('12345'), 'active' => 0, 'activation_code' => md5(microtime() . Config::get('app.key')), 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s"), 'image' => '55fa8e7a612e4.png');
     $permissions = array(['display_name' => 'Manage Admin', 'name' => 'manage_admin', 'description' => 'Give permission to user to access the admin area.', 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")], ['display_name' => 'Manage Own Data', 'name' => 'manage_own', 'description' => 'Allow users to manage their own data.', 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
     $roles = array(['display_name' => 'Admin', 'name' => 'admin', 'description' => 'Give user full permission to site functions.', 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")], ['display_name' => 'User', 'name' => 'user', 'description' => 'Standard User', 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]);
     // Create Permissions
     DB::table('permissions')->delete();
     $statement = "ALTER TABLE permissions AUTO_INCREMENT = 1;";
     DB::unprepared($statement);
     DB::table('permissions')->insert($permissions);
     // Create Roles
     DB::table('roles')->delete();
     $statement = "ALTER TABLE roles AUTO_INCREMENT = 1;";
     DB::unprepared($statement);
     DB::table('roles')->insert($roles);
     // Clear relationships
     DB::table('permission_role')->delete();
     $statement = "ALTER TABLE permission_role AUTO_INCREMENT = 1;";
     DB::unprepared($statement);
     DB::table('role_user')->delete();
     $statement = "ALTER TABLE role_user AUTO_INCREMENT = 1;";
     DB::unprepared($statement);
     // Create Users
     DB::table('users')->delete();
     $statement = "ALTER TABLE users AUTO_INCREMENT = 1;";
     DB::unprepared($statement);
     DB::table('users')->insert($admin);
     DB::table('users')->insert($user);
     // Attach permission to role
     $role = $this->role->find(1);
     $role2 = $this->role->find(2);
     /*$perm_1 = $this->permission->find(1);
             $role->attachPermission($perm_1);
     
             $perm_2 = $this->permission->find(2);
             $role2->attachPermission($perm_2);*/
     // Attach role to user
     $user = User::find(1);
     $user->roles()->attach($role);
     $user = User::find(2);
     $user->roles()->attach($role2);
 }
예제 #6
0
 public function fire()
 {
     // if ($this->confirm('Start install? [y|n]')) {
     //create table with sql
     if (!File::exists(app_path() . '/models/Tree.php')) {
         $f = scandir(__DIR__ . '/../../../dump_sql_table/');
         foreach ($f as $file) {
             if (preg_match('/\\.(sql)/', $file)) {
                 $this->info("Processed file " . $file);
                 DB::unprepared(file_get_contents(__DIR__ . '/../../../dump_sql_table/' . $file));
             }
         }
     }
     //create folder 'public/css/builds'
     if (!is_dir(public_path() . '/css/builds')) {
         File::makeDirectory(public_path() . '/css/builds', 0777, true);
         $this->info('Folder /css/builds is created');
     }
     //create folder 'public/js/builds'
     if (!is_dir(public_path() . '/js/builds')) {
         File::makeDirectory(public_path() . '/js/builds', 0777, true);
         $this->info('Folder /js/builds is created');
     }
     //replace htaccess
     //  if(!File::exists(public_path() . '/.htaccess')) {
     copy(__DIR__ . '/../../../misc/.htaccess', public_path() . '/.htaccess');
     $this->info('Replace htaccess - OK');
     //}
     //replace HomeController
     //  if(!File::exists(app_path() . '/controllers/HomeController.php')) {
     copy(__DIR__ . '/../../../misc/HomeController.php', app_path() . '/controllers/HomeController.php');
     $this->info('Replace HomeController.php - OK');
     //  }
     //replace router.php
     //if(!File::exists(app_path() . '/routes.php')) {
     copy(__DIR__ . '/../../../misc/routes.php', app_path() . '/routes.php');
     $this->info('Replace routes.php - OK');
     // }
     //replace view_composers.php
     if (!File::exists(app_path() . '/view_composers.php')) {
         copy(__DIR__ . '/../../../misc/view_composers.php', app_path() . '/view_composers.php');
         $this->info('Replace view_composers.php - OK');
     }
     //create folder mcamara/laravel-localization'
     if (!is_dir(app_path() . '/config/packages/mcamara/laravel-localization')) {
         File::makeDirectory(app_path() . '/config/packages/mcamara/laravel-localization', 0777, true);
         $this->info('Folder /config/packages/mcamara/laravel-localization is created');
         copy(__DIR__ . '/../../../misc/localization_config.php', app_path() . '/config/packages/mcamara/laravel-localization/config.php');
         $this->info('Replace laravel-localization/config.php - OK');
     }
     if (!is_dir(app_path() . '/config/packages/intervention/imagecache')) {
         File::makeDirectory(app_path() . '/config/packages/intervention/imagecache', 0777, true);
         $this->info('Folder /config/packages/intervention/imagecache is created');
         copy(__DIR__ . '/../../../misc/imagecache_config.php', app_path() . '/config/packages/intervention/imagecache/config.php');
         $this->info('Replace imagecache/config.php - OK');
     }
     //replace BaseModel.php
     if (!File::exists(app_path() . '/models/BaseModel.php')) {
         copy(__DIR__ . '/../../../misc/BaseModel.php', app_path() . '/models/BaseModel.php');
         $this->info('Replace BaseModel.php - OK');
     }
     //replace News.php
     if (!File::exists(app_path() . '/models/News.php')) {
         copy(__DIR__ . '/../../../misc/News.php', app_path() . '/models/News.php');
         $this->info('Replace News.php - OK');
     }
     //replace Tree.php
     if (!File::exists(app_path() . '/models/Tree.php')) {
         copy(__DIR__ . '/../../../misc/Tree.php', app_path() . '/models/Tree.php');
         $this->info('Replace Tree.php - OK');
     }
     //replace User.php
     // if(!File::exists(app_path() . '/models/User.php')) {
     copy(__DIR__ . '/../../../misc/User.php', app_path() . '/models/User.php');
     $this->info('Replace User.php - OK');
     //  }
     //replace Util.php
     if (!File::exists(app_path() . '/models/Util.php')) {
         copy(__DIR__ . '/../../../misc/Util.php', app_path() . '/models/Util.php');
         $this->info('Replace Util.php - OK');
     }
     //replace Breadcrumbs.php
     if (!File::exists(app_path() . '/models/Breadcrumbs.php')) {
         copy(__DIR__ . '/../../../misc/Breadcrumbs.php', app_path() . '/models/Breadcrumbs.php');
         $this->info('Replace Breadcrumbs.php - OK');
     }
     $this->call('asset:publish', array('package' => 'vis/builder'));
     if (!File::exists(app_path() . '/config/packages/vis/builder/admin.php')) {
         $this->call('config:publish', array('package' => 'vis/builder'));
     }
     if (!File::exists(app_path() . '/config/packages/cartalyst/sentry/config.php')) {
         $this->call('config:publish', array('package' => 'cartalyst/sentry'));
     }
     $this->call('cache:clear');
     $this->call('ide-helper:generate');
     //  }
     return;
 }
예제 #7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = \Faker\Factory::create();
     DB::table('countries')->delete();
     DB::unprepared(file_get_contents('database/seeds/imports/countries.sql'));
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     DB::unprepared('DROP TRIGGER IF EXISTS "before_session_delete" ON sessions;');
     DB::unprepared('DROP FUNCTION before_session_delete();');
 }