add static azmayesh fields
This commit is contained in:
@@ -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;
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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']),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class AzmayeshTypeFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'name' => $this->faker->name
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user