44 lines
942 B
PHP
44 lines
942 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use App\Models\Slot;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class SlotSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
// Weekdays: 1 = Monday, 5 = Friday
|
|
$weekdays = [1, 2, 3, 4, 5];
|
|
|
|
// Session times
|
|
$times = [
|
|
'09:00:00',
|
|
'10:00:00',
|
|
'11:00:00',
|
|
'14:00:00',
|
|
'15:00:00',
|
|
'16:00:00',
|
|
];
|
|
|
|
$slots = [];
|
|
$now = now();
|
|
|
|
foreach ($weekdays as $weekday) {
|
|
foreach ($times as $time) {
|
|
$slots[] = [
|
|
'weekday' => $weekday,
|
|
'time' => $time,
|
|
'is_active' => 1,
|
|
'created_at' => $now,
|
|
'updated_at' => $now,
|
|
];
|
|
}
|
|
}
|
|
|
|
DB::table('slots')->insert($slots);
|
|
}
|
|
} |