/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     DB::table($this->table)->truncate();
     parent::run();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('review_dog', function (Blueprint $table) {
         DB::statement('alter table review_dog modify walker_id int unsigned not null');
         $table->foreign('walker_id')->references('id')->on('walker');
     });
 }
Example #3
0
 /**
  * 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;');
 }
Example #4
0
 public static function boot()
 {
     self::creating(function ($custom_field) {
         if (in_array($custom_field->db_column_name(), \Schema::getColumnListing(\DB::getTablePrefix() . CustomField::$table_name))) {
             //field already exists when making a new custom field; fail.
             return false;
         }
         \Schema::table(\DB::getTablePrefix() . \App\Models\CustomField::$table_name, function ($table) use($custom_field) {
             $table->text($custom_field->db_column_name())->nullable();
         });
     });
     self::updating(function ($custom_field) {
         if ($custom_field->isDirty("name")) {
             if (in_array($custom_field->db_column_name(), \Schema::getColumnListing(CustomField::$table_name))) {
                 //field already exists when renaming a custom field
                 return false;
             }
             return \DB::statement("UPDATE " . CustomField::$table_name . " RENAME " . self::name_to_db_name($custom_field->get_original("name")) . " TO " . $custom_field->db_column_name());
         }
         return true;
     });
     self::deleting(function ($custom_field) {
         return \DB::statement("ALTER TABLE " . CustomField::$table_name . " DROP COLUMN " . $custom_field->db_column_name());
     });
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     DB::table('features')->truncate();
     /*
             Feature::create([
                 'href' => '/dm/home',
                 'btnclass' => 'btn-success',
                 'innerhtml' => '个人信息'
             ]);
     */
     Feature::create(['href' => '/patient', 'btnclass' => 'btn-primary', 'innerhtml' => '患者资料']);
     /*
             Feature::create([
                 'href' => '/case',
                 'btnclass' => 'btn-info',
                 'innerhtml' => '方案管理'
             ]);
     */
     Feature::create(['href' => '/bdata', 'btnclass' => 'btn-danger', 'innerhtml' => '血糖管理']);
     DB::table('hasfeatures')->truncate();
     Hasfeature::create(['user_id' => 2, 'feature_id' => 1]);
     Hasfeature::create(['user_id' => 2, 'feature_id' => 2]);
     /*
             Hasfeature::create([
                 'user_id' => 2,
                 'feature_id' => 3
             ]);
     */
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
Example #6
0
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     // Reset table
     DB::table('users')->truncate();
     // Reset table
     DB::table('user_details')->truncate();
     $admin_account = Config::get('cms::settings.admin_account');
     $admin_settings = array('role_id' => 1, 'lang' => Config::get('cms::settings.language'), 'editor' => 0, 'is_active' => 1);
     $admin_user = array_merge($admin_account, $admin_settings);
     $admin_user['password'] = Hash::make($admin_user['password']);
     $admin = User::create($admin_user);
     UserDetail::create(array('user_id' => $admin->id));
     // RANDOM 50 USERS
     // Faker data
     $faker = Faker\Factory::create();
     for ($i = 1; $i <= 50; $i++) {
         $user_settings = array('role_id' => 4, 'username' => $faker->username, 'email' => $faker->email, 'password' => Hash::make($faker->word), 'lang' => Config::get('cms::settings.language'), 'editor' => 0, 'is_active' => 1);
         $user = User::create($user_settings);
         $details = array('firstname' => $faker->firstname, 'lastname' => $faker->lastname, 'gender' => $faker->randomElement(array('m', 'f')), 'city' => $faker->city, 'bio' => $faker->text, 'birth_date' => $faker->date('Y-m-d', '-18 years'));
         $user->details()->create($details);
     }
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
 public function up()
 {
     $prefix = config('larablog.table.prefix');
     Schema::create($prefix . '_posts', function (Blueprint $t) {
         $t->increments('id')->unsigned();
         $t->string('identifier', 255)->index();
         $t->string('slug', 255)->unique()->index();
         $t->string('title', 255);
         $t->text('body');
         $t->text('meta');
         $t->enum('type', ['page', 'post', 'redirect'])->default('post');
         $t->enum('status', ['active', 'deleted'])->default('active')->index();
         $t->integer('views_count')->unsigned()->default(0)->index();
         $t->datetime('published_at')->index()->nullable();
         $t->timestamps();
         $t->index('created_at');
         $t->index('updated_at');
     });
     \DB::statement("ALTER TABLE " . $prefix . "_posts ADD FULLTEXT KEY " . $prefix . "_posts_title_body_fulltext (`title`, `body`)");
     Schema::create($prefix . '_tags', function (Blueprint $t) {
         $t->increments('id')->unsigned();
         $t->string('slug', 255)->unique()->index();
         $t->string('name', 255);
         $t->integer('posts_count')->unsigned()->default(0)->index();
         $t->timestamps();
         $t->index('created_at');
         $t->index('updated_at');
     });
     Schema::create($prefix . '_post_tag', function (Blueprint $t) {
         $t->integer('post_id')->unsigned()->index();
         $t->integer('tag_id')->unsigned()->index();
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     Schema::dropIfExists('tbestadoanimal');
     //
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     DB::statement('ALTER TABLE projects ALTER geo_lat SET DEFAULT 450');
     DB::statement('ALTER TABLE projects ALTER geo_lng SET DEFAULT 450');
     DB::statement('ALTER TABLE geocodes ALTER lat SET DEFAULT 450');
     DB::statement('ALTER TABLE geocodes ALTER lng SET DEFAULT 450');
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     Schema::dropIfExists('tborigendiag');
     //
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
 }
Example #11
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('estado')->insert(['nombre' => 'Bolivar']);
     DB::table('estado')->insert(['nombre' => 'Falcón']);
     DB::table('estado')->insert(['nombre' => 'Nueva Esparta']);
     DB::statement("INSERT INTO ciudades (`id`, `id_estado`, `nombre`, `id_capital`) VALUES\n                    (87, 1, 'Caicara del Orinoco', 0),\n                    (88, 1, 'Canaima', 0),\n                    (89, 1, 'Ciudad Bolívar', 1),\n                    (90, 1, 'Ciudad Piar', 0),\n                    (91, 1, 'El Callao', 0),\n                    (92, 1, 'El Dorado', 0),\n                    (93, 1, 'El Manteco', 0),\n                    (94, 1, 'El Palmar', 0),\n                    (95, 1, 'El Pao', 0),\n                    (96, 1, 'Guasipati', 0),\n                    (97, 1, 'Guri', 0),\n                    (98, 1, 'La Paragua', 0),\n                    (99, 1, 'Matanzas', 0),\n                    (151, 2, 'Adícora', 0),\n                    (152, 2, 'Boca de Aroa', 0),\n                    (153, 2, 'Cabure', 0),\n                    (154, 2, 'Capadare', 0),\n                    (155, 2, 'Capatárida', 0),\n                    (156, 2, 'Chichiriviche', 0),\n                    (157, 2, 'Churuguara', 0),\n                    (158, 2, 'Coro', 1),\n                    (159, 2, 'Cumarebo', 0),\n                    (160, 2, 'Dabajuro', 0),\n                    (161, 2, 'Judibana', 0),\n                    (162, 2, 'La Cruz de Taratara', 0),\n                    (163, 2, 'La Vela de Coro', 0),\n                    (164, 2, 'Los Taques', 0),\n                    (165, 2, 'Maparari', 0),\n                    (166, 2, 'Mene de Mauroa', 0),\n                    (167, 2, 'Mirimire', 0),\n                    (168, 2, 'Pedregal', 0),\n                    (169, 2, 'Píritu Falcón', 0),\n                    (170, 2, 'Pueblo Nuevo Falcón', 0),\n                    (171, 2, 'Puerto Cumarebo', 0),\n                    (172, 2, 'Punta Cardón', 0),\n                    (173, 2, 'Punto Fijo', 0),\n                    (174, 2, 'San Juan de Los Cayos', 0),\n                    (175, 2, 'San Luis', 0),\n                    (176, 2, 'Santa Ana Falcón', 0),\n                    (177, 2, 'Santa Cruz De Bucaral', 0),\n                    (178, 2, 'Tocopero', 0),\n                    (179, 2, 'Tocuyo de La Costa', 0),\n                    (180, 2, 'Tucacas', 0),\n                    (181, 2, 'Yaracal', 0),\n                    (321, 3, 'Altagracia', 0),\n                    (322, 3, 'Boca de Pozo', 0),\n                    (323, 3, 'Boca de Río', 0),\n                    (324, 3, 'El Espinal', 0),\n                    (325, 3, 'El Valle del Espíritu Santo', 0),\n                    (326, 3, 'El Yaque', 0),\n                    (327, 3, 'Juangriego', 0),\n                    (328, 3, 'La Asunción', 1),\n                    (329, 3, 'La Guardia', 0),\n                    (330, 3, 'Pampatar', 0),\n                    (331, 3, 'Porlamar', 0),\n                    (332, 3, 'Puerto Fermín', 0),\n                    (333, 3, 'Punta de Piedras', 0),\n                    (334, 3, 'San Francisco de Macanao', 0),\n                    (335, 3, 'San Juan Bautista', 0),\n                    (336, 3, 'San Pedro de Coche', 0),\n                    (337, 3, 'Santa Ana de Nueva Esparta', 0),\n                    (338, 3, 'Villa Rosa', 0)\n        ");
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0');
     Model::unguard();
     $this->call('UserSeeder');
     $this->call('UnitSeeder');
     $this->call('TagSeeder');
     // foods
     $this->call('FoodSeeder');
     $this->call('RecipeSeeder');
     $this->call('FoodEntrySeeder');
     //        $this->call('FoodRecipeSeeder');
     $this->call('RecipeMethodSeeder');
     //exercises
     $this->call('ExerciseSeriesSeeder');
     $this->call('ExerciseProgramSeeder');
     $this->call('ExerciseSeeder');
     $this->call('ExerciseEntrySeeder');
     $this->call('WorkoutSeeder');
     //weight
     $this->call('WeightSeeder');
     //journal
     $this->call('JournalSeeder');
     //tags
     $this->call('ActivitySeeder');
     $this->call('TimerSeeder');
     DB::statement('SET FOREIGN_KEY_CHECKS=1');
 }
Example #13
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement("SET foreign_key_checks = 0");
     Apartment::truncate();
     Apartment::create(['name' => 'Krushna Apartment', 'address_line1' => 'Yadav Nagar', 'address_line2' => 'Nr. Some Square', 'address_line3' => 'Jaiswal Restaurent', 'city' => 'Nagpur', 'state' => 'Maharashtra', 'country' => 'India', 'pincode' => '440026', 'lat' => '1.000', 'lng' => '2.000']);
     Apartment::create(['name' => 'Ravan Apartment', 'address_line1' => 'Gajanan Nagar', 'address_line2' => 'Nr. Some Square', 'address_line3' => 'Lagoo Restaurent', 'city' => 'Nagpur', 'state' => 'Maharashtra', 'country' => 'India', 'pincode' => '440032', 'lat' => '1.000', 'lng' => '2.000']);
 }
Example #14
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     DB::table('answers')->truncate();
     $quiz = new Answer();
     $quiz->question_id = 1;
     $quiz->user_id = 1;
     $quiz->title = 'Seeded answer 1';
     $quiz->is_right = 1;
     $quiz->save();
     $quiz = new Answer();
     $quiz->question_id = 1;
     $quiz->user_id = 1;
     $quiz->title = 'Seeded answer 1';
     $quiz->is_right = 0;
     $quiz->save();
     $quiz = new Answer();
     $quiz->question_id = 2;
     $quiz->user_id = 1;
     $quiz->title = 'Seeded answer 1';
     $quiz->is_right = 0;
     $quiz->save();
     $quiz = new Answer();
     $quiz->question_id = 2;
     $quiz->user_id = 1;
     $quiz->title = 'Seeded answer 1';
     $quiz->is_right = 1;
     $quiz->save();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
Example #15
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     //
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     Schema::dropIfExists('comments');
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('fbf_jobs', function (Blueprint $table) {
         $table->engine = 'MyISAM';
         // means you can't use foreign key constraints
         $table->increments('id');
         $table->string('title');
         $table->string('slug')->unique();
         $table->string('reference')->nullable();
         $table->string('location')->nullable();
         $table->enum('type', array('PERMANENT', 'TEMPORARY'))->nullable();
         $table->enum('time', array('FULL_TIME', 'PART_TIME'))->nullable();
         $table->string('salary_text')->nullable();
         $table->float('salary_from', 10, 2)->nullable();
         $table->float('salary_to', 10, 2)->nullable();
         $table->date('closing_date')->nullable();
         $table->text('description')->nullable();
         $table->text('search_extra')->nullable();
         $table->text('meta_description')->nullable();
         $table->text('meta_keywords')->nullable();
         $table->enum('status', array('DRAFT', 'APPROVED'))->default('DRAFT');
         $table->dateTime('published_date');
         $table->timestamps();
         $table->softDeletes();
     });
     DB::statement('ALTER TABLE fbf_jobs ADD FULLTEXT search(title,description,reference,location,search_extra,meta_description,meta_keywords)');
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     // drop table
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     Schema::dropIfExists('reports');
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     DB::statement('
          ALTER TABLE `news` 
                 MODIFY `featured_image` VARCHAR(255) NOT NULL;
     ');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     $this->call(RolesTableSeeder::class);
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
 public function update($id, Request $request)
 {
     $validator = Validator::make($request->all(), ['first_name' => 'required', 'last_name' => 'required']);
     if ($validator->fails()) {
         $messages = $validator->messages();
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         \DB::statement('SET FOREIGN_KEY_CHECKS = 0');
         $supplier = Supplier::find($id);
         $supplier->fill($request->except('_token'));
         $supplier->parent_id = 0;
         if ($request->password != '') {
             $supplier->password = Hash::make($request->password);
         }
         if (Input::hasFile('profileimage')) {
             $file = Input::file('profileimage');
             $imagename = time() . '.' . $file->getClientOriginalExtension();
             if (\File::exists(public_path('upload/supplierprofile/' . $supplier->image))) {
                 \File::delete(public_path('upload/supplierprofile/' . $supplier->image));
             }
             $path = public_path('upload/supplierprofile/' . $imagename);
             $image = \Image::make($file->getRealPath())->save($path);
             $th_path = public_path('upload/supplierprofile/thumb/' . $imagename);
             $image = \Image::make($file->getRealPath())->resize(128, 128)->save($th_path);
             $supplier->image = $imagename;
         }
         $supplier->save();
         \DB::statement('SET FOREIGN_KEY_CHECKS = 1');
         return Redirect::route('supplier_master_list')->with('succ_msg', 'Supplier has been created successfully!');
     }
 }
Example #21
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     $this->call(ArticleTableSeeder::class);
     $this->call(UserTableSeeder::class);
     $this->call(RoleTableSeeder::class);
     $this->call(CategoryTableSeeder::class);
     $this->call(DailyEventTableSeeder::class);
     $this->call(WeekTableSeeder::class);
     $this->call(ClanTableSeeder::class);
     $this->call(SliderTableSeeder::class);
     $this->call(GalaryTableSeeder::class);
     $this->call(PopupTableSeeder::class);
     $this->call(CardTableSeeder::class);
     $this->call(CardUserTableSeeder::class);
     $this->call(GiftTableSeeder::class);
     $this->call(GiftUsersTableSeeder::class);
     $this->call(ServerTableSeeder::class);
     $this->call(CharacterTbaleSeeder::class);
     $this->call(ItemsTableSeeder::class);
     $this->call(ItemTypeTableSeeder::class);
     $this->call(GiftFresherTableSeeder::class);
     $this->call(QuaDatMocTableSeeder::class);
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
     Model::reguard();
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     DB::statement('ALTER TABLE geonames_names MODIFY COLUMN elevation INT NOT NULL');
     DB::statement('ALTER TABLE geonames_countries MODIFY COLUMN area DOUBLE NOT NULL');
     DB::statement('ALTER TABLE geonames_countries MODIFY COLUMN phone VARCHAR(10)');
     DB::statement('ALTER TABLE geonames_countries MODIFY COLUMN name_id INT NOT NULL');
 }
 public function run()
 {
     DB::statement("SET foreign_key_checks = 0");
     DB::table('rewards')->delete();
     $rewards = [['num_referrals' => 0, 'title' => 'Two Weeks Free', 'description' => 'Sign up to receive two weeks for free', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()], ['num_referrals' => 1, 'title' => 'Additional Two Weeks Free', 'description' => 'Refer 1 friends for an additional two weeks for free', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()], ['num_referrals' => 3, 'title' => 'Additional Month Free', 'description' => 'Refer 3 or more friends for an additional month for free', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]];
     DB::table('rewards')->insert($rewards);
 }
Example #24
0
 /**
  * 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();
 }
 protected function insert_data($table_name, array $data)
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     DB::table($table_name)->truncate();
     DB::table($table_name)->insert($data);
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
 }
 public function up()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     Schema::table('historicomudancaestado', function (Blueprint $table) {
         $table->dropForeign(['fkTransacao']);
     });
     Schema::table('transacao', function (Blueprint $table) {
         $table->dropForeign(['fkEmpresa']);
         $table->dropForeign(['fkCartao']);
         $table->dropForeign(['fkTipoTransacao']);
         $table->dropForeign(['fkEstadoTransacao']);
     });
     Schema::drop('transacao');
     Schema::create('transacoes', function (Blueprint $table) {
         $table->increments('id')->unsigned();
         $table->integer('idUsuario')->unsigned();
         $table->integer('idTipoTransacao')->unsigned();
         $table->integer('idEstadoTransacao')->unsigned();
         $table->double('valorBruto');
         $table->string('cardHashMensal')->nullable;
         $table->string('cardHash')->nullable();
         $table->timestamps();
     });
     Schema::table('transacoes', function (Blueprint $table) {
         $table->foreign('idUsuario')->references('id')->on('users');
         $table->foreign('idTipoTransacao')->references('idTipoTransacao')->on('tipotransacao');
         $table->foreign('idEstadoTransacao')->references('idEstadoTransacao')->on('estadotransacao');
     });
     Schema::table('historicomudancaestado', function (Blueprint $table) {
         $table->foreign('fkTransacao')->references('id')->on('transacoes');
     });
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
Example #27
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //Model::unguard();
     // DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // \App\Provinsi::truncate();
     // DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // \App\Kabupaten::truncate();
     // DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // \App\Kecamatan::truncate();
     // DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     \App\Kelurahan::truncate();
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     $this->call(ProvinsiPart1Seeder::class);
     $classes = (require base_path() . '/vendor/composer/autoload_classmap.php');
     foreach ($classes as $class) {
         //if(strpos($class, 'Seeder') !== false && strpos($class, 'Kelurahan') == true)
         if (strpos($class, 'Seeder') !== false && strpos($class, 'DatabaseSeeder') != true && strpos($class, 'ProvinsiPart1Seeder') != true) {
             $seederClass = substr(last(explode('/', $class)), 0, -4);
             //var_dump($seederClass);
             $this->call($seederClass);
         }
     }
     //Model::reguard();
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (Schema::hasTable('phpbb_sessions')) {
         return;
     }
     Schema::create('phpbb_sessions', function ($table) {
         $table->collation = 'utf8_bin';
         $table->charset = 'utf8';
         $table->string('session_id', 32)->default('');
         $table->mediumInteger('session_user_id')->unsigned()->default(0);
         $table->integer('session_last_visit')->unsigned()->default(0);
         $table->integer('session_start')->unsigned()->default(0);
         $table->integer('session_time')->unsigned()->default(0);
         $table->string('session_ip', 40)->default('');
         $table->string('session_forwarded_for')->default('');
         $table->string('session_page')->default('');
         $table->boolean('session_viewonline')->unsigned()->default(1);
         $table->boolean('session_autologin')->unsigned()->default(0);
         $table->boolean('session_admin')->unsigned()->default(0);
         $table->boolean('verified')->default(0);
         $table->primary('session_id');
         $table->index(['session_time', 'session_page'], 'time_page');
         $table->index(['session_autologin', 'session_time'], 'autologin_time_purge');
         $table->index(['session_user_id', 'session_time'], 'session_user_id_time');
     });
     DB::statement('ALTER TABLE phpbb_sessions ROW_FORMAT=DYNAMIC');
 }
Example #29
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     DB::table('cijfer')->truncate();
     $toetsen = Toets::all();
     //$cijfers = factory(Cijfer::class, count($toetsen)*count($leerlingen))->create();
     for ($i = 0; $i < count($toetsen); ++$i) {
         //dd($toetsen[$i]->toetsenlijst()->first()->lesopdracht()->first()->klas()->first()->leerlingen()->first());
         $klas = $toetsen[$i]->toetsenlijst()->first()->lesopdracht()->first()->klas()->first()->code;
         if (substr($klas, 0, 1) != '5') {
             continue;
         }
         $leerlingen = $toetsen[$i]->toetsenlijst()->first()->lesopdracht()->first()->klas()->first()->leerlingen()->get();
         for ($j = 0; $j < count($leerlingen); ++$j) {
             $cijfer = factory(Cijfer::class, 1)->create();
             $cijfer["waarde"] = rand(0, 10);
             $cijfer["toets_id"] = $toetsen[$i]["id"];
             $cijfer["leerling_id"] = $leerlingen[$j]["id"];
             $cijfer->save();
         }
     }
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     Model::reguard();
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     Teacher::truncate();
     factory(Teacher::class, 20)->create();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }