feat: add shift management functionality
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -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'],
|
||||
|
||||
@@ -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([
|
||||
|
||||
Reference in New Issue
Block a user