initial: project state before operator dashboard card redesign

This commit is contained in:
ghassan committed 2026-04-15 11:39:10 +03:00
commit e0aed8eed7
113 files changed
+20074

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash;
class AdminUserSeeder extends Seeder
{
public function run(): void
{
// Super Admin
User::updateOrCreate(
['email' => '[email protected]'],
[
'name' => 'مدير النظام',
'role' => 'admin',
'password' => Hash::make('admin123'),
]
);
// Operator
User::updateOrCreate(
['email' => '[email protected]'],
[
'name' => 'مشغل الموقف',
'role' => 'operator',
'password' => Hash::make('operator123'),
]
);
echo "✅ Super Admin: [email protected] / admin123\n";
echo "✅ Operator: [email protected] / operator123\n";
}
}
?>
+67
View File
@@ -0,0 +1,67 @@
<?php
namespace Database\Seeders;
use App\Models\Booking;
use App\Models\ParkingLot;
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class BookingSeeder extends Seeder
{
public function run(): void
{
$lots = ParkingLot::all();
if ($lots->isEmpty()) {
return;
}
$names = ['أحمد الخطيب', 'سامر العلي', 'رنا موسى', 'خالد إبراهيم', 'منى حسن',
'عمر الزعبي', 'لينا صالح', 'فراس نعمة', 'هبة الدار', 'باسل قاسم',
'نور السيد', 'وسيم طه', 'ديانا فارس', 'زياد جبر', 'ريم عبدالله'];
$phones = ['0912345678', '0923456789', '0934567890', '0945678901', '0956789012',
'0967890123', '0978901234', '0989012345', '0990123456', '0901234567'];
$now = Carbon::now();
// Seed bookings spread across the last 7 days
foreach ($lots as $lot) {
// 2–5 active bookings per lot
$activeCount = rand(2, 5);
for ($i = 0; $i < $activeCount; $i++) {
$start = $now->clone()->subHours(rand(1, 5));
$end = $start->clone()->addHours(rand(1, 4));
Booking::create([
'parking_lot_id' => $lot->id,
'customer_name' => $names[array_rand($names)],
'phone' => $phones[array_rand($phones)],
'start_time' => $start,
'end_time' => $end,
'status' => 'active',
'created_at' => $start,
'updated_at' => $start,
]);
}
// 3–8 completed bookings spread over the past 7 days
$completedCount = rand(3, 8);
for ($i = 0; $i < $completedCount; $i++) {
$daysAgo = rand(0, 6);
$start = $now->clone()->subDays($daysAgo)->subHours(rand(2, 10));
$end = $start->clone()->addHours(rand(1, 3));
Booking::create([
'parking_lot_id' => $lot->id,
'customer_name' => $names[array_rand($names)],
'phone' => $phones[array_rand($phones)],
'start_time' => $start,
'end_time' => $end,
'status' => 'completed',
'created_at' => $start,
'updated_at' => $end,
]);
}
}
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
use WithoutModelEvents;
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
$this->call(ParkingLotSeeder::class);
$this->call(BookingSeeder::class);
}
}
+81
View File
@@ -0,0 +1,81 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\ParkingLot;
use App\Models\CarRegistry;
class ParkingLotSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$lots = [
[
'name' => 'موقف البرامكة',
'address' => 'شارع البرامكة، دمشق',
'total_capacity' => 120,
'price_per_hour' => 1500,
'latitude' => 33.5138,
'longitude' => 36.2765,
'working_hours' => '06:00 - 22:00',
],
[
'name' => 'موقف المرجة',
'address' => 'ساحة المرجة، دمشق القديمة',
'total_capacity' => 80,
'price_per_hour' => 2000,
'working_hours' => '24/7',
'latitude' => 33.5105,
'longitude' => 36.3118,
],
[
'name' => 'موقف المالكي',
'address' => 'شارع المالكي، دمشق',
'total_capacity' => 60,
'price_per_hour' => 1200,
'working_hours' => '24/7',
'latitude' => 33.5230,
'longitude' => 36.3050,
],
[
'name' => 'موقف المزة',
'address' => 'شارع المزة الأوتوستراد',
'total_capacity' => 100,
'price_per_hour' => 1800,
'working_hours' => '05:00 - 23:00',
'latitude' => 33.5080,
'longitude' => 36.2650,
],
[
'name' => 'موقف كفرسوسة',
'address' => 'طريق المزة، كفرسوسة',
'total_capacity' => 75,
'price_per_hour' => 1000,
'working_hours' => '24/7',
'latitude' => 33.4980,
'longitude' => 36.2450,
],
];
foreach ($lots as $lotData) {
$lot = ParkingLot::create($lotData);
// Seed some active car registries (walk-ins + bookings) for realistic availability
$occupied = rand(10, (int)($lotData['total_capacity'] * 0.4)); // 10-40% occupied
for ($i = 0; $i < $occupied; $i++) {
CarRegistry::create([
'parking_lot_id' => $lot->id,
'plate_number' => sprintf('%d س دم %s', rand(100, 999), substr(md5(rand()), 0, 3)),
'entry_time' => now()->subHours(rand(1, 12)),
'exit_time' => rand(0, 4) > 3 ? null : now()->addHours(rand(1, 6)), // Most still active
]);
}
}
}
}
?>