add columns to cartable

This commit is contained in:
2025-09-29 11:44:42 +03:30
parent 38c24daa17
commit aa898576eb
6 changed files with 11 additions and 6 deletions

View File

@@ -38,6 +38,7 @@ class RahdaranController extends Controller
'province_id' => $province->id, 'province_id' => $province->id,
'province_name' => $province->name_fa, 'province_name' => $province->name_fa,
'edareh_shahri_id' => $request->edareh_shahri_id, 'edareh_shahri_id' => $request->edareh_shahri_id,
'is_driver' => $request->is_driver,
]); ]);
return $this->successResponse(); return $this->successResponse();
@@ -59,6 +60,7 @@ class RahdaranController extends Controller
'province_id' => $province->id, 'province_id' => $province->id,
'province_name' => $province->name_fa, 'province_name' => $province->name_fa,
'edareh_shahri_id' => $request->edareh_shahri_id, 'edareh_shahri_id' => $request->edareh_shahri_id,
'is_driver' => $request->is_driver,
]); ]);
return $this->successResponse(); return $this->successResponse();

View File

@@ -25,7 +25,8 @@ class AllocateRequest extends FormRequest
return [ return [
'machines' => 'required|array', 'machines' => 'required|array',
'machines.*' => 'required|integer|exists:cmms_machines,id', 'machines.*' => 'required|integer|exists:cmms_machines,id',
'driver' => 'required|integer|exists:rahdaran,id' 'driver' => 'required|integer|exists:rahdaran,id',
'km' => 'required',
]; ];
} }
} }

View File

@@ -28,6 +28,7 @@ class StoreRequest extends FormRequest
'mobile' => 'required|digits:11|regex:/^09\d{9}$/', 'mobile' => 'required|digits:11|regex:/^09\d{9}$/',
'province_id' => 'required|exists:provinces,id', 'province_id' => 'required|exists:provinces,id',
'edareh_shahri_id' => 'required|exists:edarate_shahri,id', 'edareh_shahri_id' => 'required|exists:edarate_shahri,id',
'is_driver' => 'required|boolean',
]; ];
} }
} }

View File

@@ -29,6 +29,7 @@ class UpdateRequest extends FormRequest
'mobile' => 'required|digits:11|regex:/^09\d{9}$/', 'mobile' => 'required|digits:11|regex:/^09\d{9}$/',
'province_id' => 'required|exists:provinces,id', 'province_id' => 'required|exists:provinces,id',
'edareh_shahri_id' => 'required|exists:edarate_shahri,id', 'edareh_shahri_id' => 'required|exists:edarate_shahri,id',
'is_driver' => 'required|boolean',
]; ];
} }
} }

View File

@@ -25,7 +25,7 @@ class TransportationUnitService
'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name', 'id', 'user_id', 'username', 'state_name', 'province_name', 'edare_shahri_name',
'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id', 'description', 'requested_machines', 'type', 'type_fa', 'start_date', 'state_id',
'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time', 'end_date', 'request_date', 'end_point', 'area', 'zone', 'zone_fa', 'start_time', 'finish_time',
'code', 'category_id', 'category_name', 'explanation' 'code', 'category_id', 'category_name', 'explanation', 'km'
] ]
); );
} }

View File

@@ -12,10 +12,10 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('rahdaran', function (Blueprint $table) { Schema::table('rahdaran', function (Blueprint $table) {
$table->unsignedTinyInteger('province_id'); $table->unsignedTinyInteger('province_id')->nullable();
$table->foreign('province_id')->references('id')->on('provinces'); $table->foreign('province_id')->references('id')->on('provinces');
$table->string('province_name'); $table->string('province_name')->nullable();
$table->unsignedBigInteger('edareh_shahri_id'); $table->unsignedBigInteger('edareh_shahri_id')->nullable();
$table->foreign('edareh_shahri_id')->references('id')->on('edarate_shahri'); $table->foreign('edareh_shahri_id')->references('id')->on('edarate_shahri');
$table->boolean('is_driver')->default(false); $table->boolean('is_driver')->default(false);
}); });
@@ -29,7 +29,7 @@ return new class extends Migration
Schema::table('rahdaran', function (Blueprint $table) { Schema::table('rahdaran', function (Blueprint $table) {
$table->dropForeign('province_id'); $table->dropForeign('province_id');
$table->dropForeign('edareh_shahri_id'); $table->dropForeign('edareh_shahri_id');
$table->dropColumn(['province_id', 'province_name']); $table->dropColumn(['province_id', 'province_name', 'edareh_shahri_id', 'is_driver']);
}); });
} }
}; };