add static azmayesh fields

This commit is contained in:
2024-10-23 15:54:01 +03:30
parent c2ceb3d343
commit e9098b0a55
12 changed files with 137 additions and 18 deletions

View File

@@ -2,6 +2,8 @@
namespace Database\Factories;
use App\Models\AzmayeshType;
use App\Models\Province;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
@@ -17,7 +19,14 @@ class AzmayeshFactory extends Factory
public function definition(): array
{
return [
//
'azmayesh_type_id' => AzmayeshType::factory(),
'azmayesh_type_name' => function (array $attributes) {
return AzmayeshType::query()->find($attributes['azmayesh_type_id'])->name;
},
'province_id' => Province::factory(),
'province_name' => function (array $attributes) {
return Province::query()->find($attributes['province_id'])->name;
},
];
}
}

View File

@@ -17,7 +17,9 @@ class AzmayeshFieldFactory extends Factory
public function definition(): array
{
return [
//
'name' => $this->faker->name,
'unit' => $this->faker->name,
'type' => $this->faker->name,
];
}
}

View File

@@ -2,6 +2,7 @@
namespace Database\Factories;
use App\Models\Azmayesh;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
@@ -17,7 +18,11 @@ class AzmayeshSampleFactory extends Factory
public function definition(): array
{
return [
//
'azmayesh_id' => Azmayesh::factory(),
'azmayesh_name' => function (array $attributes) {
return Azmayesh::query()->find($attributes['azmayesh_id'])->name;
},
'data' => json_encode(['test']),
];
}
}

View File

@@ -17,7 +17,7 @@ class AzmayeshTypeFactory extends Factory
public function definition(): array
{
return [
//
'name' => $this->faker->name
];
}
}