add rahdar id to road item project

This commit is contained in:
2024-12-15 10:08:49 +03:30
parent e7163490c9
commit 1b60739a14
12 changed files with 477 additions and 30 deletions

View File

@@ -17,7 +17,8 @@ class RahdaranFactory extends Factory
public function definition(): array
{
return [
//
'name' => fake()->name,
'code' => fake()->numerify,
];
}
}

View File

@@ -0,0 +1,31 @@
<?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::table('road_items_projects', function (Blueprint $table) {
$table->foreignId('rahdar_id')->nullable()->constrained('rahdaran');
$table->string('rahdar_code')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('road_items_projects', function (Blueprint $table) {
$table->dropForeign(['rahdar_id']);
$table->dropColumn('rahdar_id');
$table->dropColumn('rahdar_code');
});
}
};

View File

@@ -2,6 +2,7 @@
namespace Database\Seeders;
use App\Models\Rahdaran;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
@@ -12,6 +13,6 @@ class RahdaranSeeder extends Seeder
*/
public function run(): void
{
//
Rahdaran::factory(5)->create();
}
}