cuti-waf/database/factories/AclGroupFactory.php
2022-07-26 07:01:25 +07:00

59 lines
1.2 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Group;
use Illuminate\Database\Eloquent\Factories\Factory;
class AclGroupFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string|null
*/
protected $model = Group::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->unique()->randomElement([
'personalia', 'supervisor', 'staff',
]),
'guard_name' => 'web',
];
}
public function personalia(): static
{
return $this->state(function (array $attributes) {
return [
'name' => 'personalia',
];
});
}
public function supervisor(): static
{
return $this->state(function (array $attributes) {
return [
'name' => 'supervisor',
];
});
}
public function staff(): static
{
return $this->state(function (array $attributes) {
return [
'name' => 'staff',
];
});
}
}