40 lines
No EOL
914 B
PHP
40 lines
No EOL
914 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Language;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Language>
|
|
*/
|
|
class LanguageFactory extends Factory
|
|
{
|
|
protected $model = Language::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'short_code' => $this->faker->unique()->languageCode(),
|
|
'name' => $this->faker->unique()->word(),
|
|
'native_name' => $this->faker->optional()->word(),
|
|
'is_active' => true,
|
|
];
|
|
}
|
|
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_active' => false,
|
|
]);
|
|
}
|
|
|
|
public function english(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'short_code' => 'en',
|
|
'name' => 'English',
|
|
'native_name' => 'English',
|
|
]);
|
|
}
|
|
} |