This commit is contained in:
f4ilji
2024-12-04 01:03:59 +05:00
parent b896328241
commit 05e99d4e20
5 changed files with 44 additions and 93 deletions
@@ -1,46 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Laravel\Fortify\Fortify;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->text('two_factor_secret')
->after('password')
->nullable();
$table->text('two_factor_recovery_codes')
->after('two_factor_secret')
->nullable();
if (Fortify::confirmsTwoFactorAuthentication()) {
$table->timestamp('two_factor_confirmed_at')
->after('two_factor_recovery_codes')
->nullable();
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(array_merge([
'two_factor_secret',
'two_factor_recovery_codes',
], Fortify::confirmsTwoFactorAuthentication() ? [
'two_factor_confirmed_at',
] : []));
});
}
};
+37 -37
View File
@@ -31,43 +31,43 @@ class DatabaseSeeder extends Seeder
'slug' => 'failj',
'password' => "$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi",
]);
User::factory()->count(50)->has(UserDetail::factory())->create();
EventCategory::factory()->count(10)->create();
Category::factory()->count(80)->create();
Post::factory()->count(1000)->create();
Event::factory()->count(200)->create();
Faculty::factory()->count(6)->create();
Department::factory()->count(12)->create();
for ($i = 0; $i < 20; $i++) {
DB::table('workers_departments')->insert([
'user_id' => User::inRandomOrder()->first()->id,
'department_id' => Department::inRandomOrder()->first()->id,
'position' => $faker->word,
'created_at' => now(),
'updated_at' => now(),
]);
}
for ($i = 0; $i < 20; $i++) {
DB::table('workers_faculties')->insert([
'user_id' => User::inRandomOrder()->first()->id,
'faculty_id' => Faculty::inRandomOrder()->first()->id,
'position' => $faker->word,
'created_at' => now(),
'updated_at' => now(),
]);
}
for ($i = 0; $i < 30; $i++) {
DB::table('teachers_departments')->insert([
'user_id' => User::inRandomOrder()->first()->id,
'department_id' => Department::inRandomOrder()->first()->id,
'teaching_position' => $faker->word,
'created_at' => now(),
'updated_at' => now(),
]);
}
// User::factory()->count(50)->has(UserDetail::factory())->create();
// EventCategory::factory()->count(10)->create();
// Category::factory()->count(80)->create();
// Post::factory()->count(1000)->create();
// Event::factory()->count(200)->create();
// Faculty::factory()->count(6)->create();
// Department::factory()->count(12)->create();
//
// for ($i = 0; $i < 20; $i++) {
// DB::table('workers_departments')->insert([
// 'user_id' => User::inRandomOrder()->first()->id,
// 'department_id' => Department::inRandomOrder()->first()->id,
// 'position' => $faker->word,
// 'created_at' => now(),
// 'updated_at' => now(),
// ]);
// }
//
// for ($i = 0; $i < 20; $i++) {
// DB::table('workers_faculties')->insert([
// 'user_id' => User::inRandomOrder()->first()->id,
// 'faculty_id' => Faculty::inRandomOrder()->first()->id,
// 'position' => $faker->word,
// 'created_at' => now(),
// 'updated_at' => now(),
// ]);
// }
//
// for ($i = 0; $i < 30; $i++) {
// DB::table('teachers_departments')->insert([
// 'user_id' => User::inRandomOrder()->first()->id,
// 'department_id' => Department::inRandomOrder()->first()->id,
// 'teaching_position' => $faker->word,
// 'created_at' => now(),
// 'updated_at' => now(),
// ]);
// }
// $this->call([RolesSeeder::class]);
// $users = [
// [