feat: add shift management functionality

This commit is contained in:
2026-08-26 18:53:15 +03:30
parent 2d96978c38
commit aeef95339d
34 changed files with 1953 additions and 15 deletions
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('shifts', function (Blueprint $table) {
$table->id();
$table->string('day_of_week')->nullable();
$table->date('date')->nullable();
$table->time('start_time');
$table->time('end_time');
$table->boolean('is_active')->default(true);
$table->timestamps();
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->index(['day_of_week', 'is_active']);
$table->index(['date', 'is_active']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('shifts');
}
};
+3 -2
View File
@@ -35,9 +35,10 @@ class FastRequestSeeder extends Seeder
return collect($doctors)->map(function ($doctor) {
return User::firstOrCreate(
['username' => explode('@', $doctor['email'])[0]],
User::factory()->raw([
['email' => $doctor['email']],
array_merge(User::factory()->raw(), [
'email' => $doctor['email'],
'username' => explode('@', $doctor['email'])[0],
'level' => UserEnum::Doctor->value,
'fullname' => $doctor['fullname'],
'specialty' => $doctor['specialty'],
+10
View File
@@ -99,6 +99,16 @@ class PermissionSeeder extends Seeder
'own' => 'دسترسی به گزارش خود',
],
],
'shifts' => [
'label' => 'دسترسی به شیفت ها',
'children' => [
'index' => 'دسترسی به لیست شیفت ها',
'create' => 'دسترسی به ایجاد شیفت',
'edit' => 'دسترسی به ویرایش شیفت',
'delete' => 'دسترسی به حذف شیفت',
'own' => 'دسترسی به شیفت های خود',
],
],
];
foreach ($permissions as $key => $data) {
$parent = Permission::create([