refactor(factories): Update name generation in Brand and Category factories to use company names, and add user_id to Employee factory for better data association
This commit is contained in:
parent
44b7358768
commit
06921096ba
@ -12,7 +12,7 @@ class BrandFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->unique()->name(),
|
||||
'name' => $this->faker->unique()->company(),
|
||||
'slug' => $this->faker->slug(),
|
||||
'sort_order' => function () {
|
||||
$max = Brand::max('sort_order') ?? 0;
|
||||
|
||||
@ -12,7 +12,7 @@ class CategoryFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->unique()->name(),
|
||||
'name' => $this->faker->unique()->company(),
|
||||
'slug' => $this->faker->slug(),
|
||||
'description' => $this->faker->optional()->text(),
|
||||
'sort_order' => function () {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
use App\Enums\EmploymentStatus;
|
||||
use App\Enums\Gender;
|
||||
use App\Models\Employee;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class EmployeeFactory extends Factory
|
||||
@ -14,6 +15,7 @@ class EmployeeFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'full_name' => $this->faker->name(),
|
||||
'code' => Employee::generateEmployeeCode(),
|
||||
'phone_number' => $this->faker->randomElement([
|
||||
|
||||
@ -14,6 +14,7 @@ public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->company(),
|
||||
'slug' => $this->faker->slug(),
|
||||
'phone_number' => $this->faker->randomElement([
|
||||
$this->faker->numerify('0812 #### ###'),
|
||||
$this->faker->numerify('0812 #### ####'),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user