add rahdar id to road item project
This commit is contained in:
@@ -17,7 +17,8 @@ class RahdaranFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'name' => fake()->name,
|
||||
'code' => fake()->numerify,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user