35 lines
779 B
PHP
35 lines
779 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\NewsCategory;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
class NewsCategoryFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = NewsCategory::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition()
|
|
{
|
|
if ($this->faker->boolean(25)) {
|
|
$label = $this->faker->regexify('[A-Z]{1}[a-z]{2,5} [a-z]{2,10}');
|
|
} else {
|
|
$label = $this->faker->regexify('[A-Z]{1}[a-z]{2,5}');
|
|
}
|
|
return [
|
|
'label' => $label,
|
|
'slug' => Str::slug($label),
|
|
];
|
|
}
|
|
}
|