base commit
This commit is contained in:
36
database/factories/DepartmentFactory.php
Normal file
36
database/factories/DepartmentFactory.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Department;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Department>
|
||||
*/
|
||||
class DepartmentFactory extends Factory
|
||||
{
|
||||
protected $model = Department::class;
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->unique()->company(),
|
||||
'code' => strtoupper(fake()->unique()->bothify('??##')),
|
||||
'description' => fake()->optional()->sentence(),
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes): array => [
|
||||
'is_active' => false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user