You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.9 KiB

11 months ago
<?php
namespace Database\Factories;
use App\Models\Blacklist;
use Illuminate\Database\Eloquent\Factories\Factory;
class BlacklistFactory extends Factory
{
protected $model = Blacklist::class;
public function definition()
{
return [
'name' => $this->faker->name,
'mobile' => $this->faker->phoneNumber,
'idcard' => $this->faker->numerify('11010119########'),
'credent' => $this->faker->randomElement([
Blacklist::CREDENT_ID_CARD,
Blacklist::CREDENT_PASSPORT,
]),
'status' => $this->faker->randomElement([
Blacklist::STATUS_DISABLED,
Blacklist::STATUS_ENABLED,
]),
'start_date' => $this->faker->optional()->date(),
'end_date' => $this->faker->optional()->date(),
'reason' => $this->faker->sentence,
'company_name' => $this->faker->company,
'file' => $this->faker->randomElements([1, 2, 3, 4, 5], $this->faker->numberBetween(0, 3)),
];
}
public function enabled()
{
return $this->state(function (array $attributes) {
return [
'status' => Blacklist::STATUS_ENABLED,
];
});
}
public function disabled()
{
return $this->state(function (array $attributes) {
return [
'status' => Blacklist::STATUS_DISABLED,
];
});
}
public function idCard()
{
return $this->state(function (array $attributes) {
return [
'credent' => Blacklist::CREDENT_ID_CARD,
];
});
}
public function passport()
{
return $this->state(function (array $attributes) {
return [
'credent' => Blacklist::CREDENT_PASSPORT,
];
});
}
}