generated from panliang/owl-admin-starter
36 lines
780 B
PHP
36 lines
780 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\PartyCate;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use App\Admin\Services\PartyCateService;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\PartyCate>
|
|
*/
|
|
class PartyCateFactory extends Factory
|
|
{
|
|
protected $model = PartyCate::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$faker = $this->faker;
|
|
return [
|
|
'name' => $faker->streetName,
|
|
];
|
|
}
|
|
|
|
public function configure(): static
|
|
{
|
|
return $this->afterCreating(function (PartyCate $cate) {
|
|
PartyCateService::make()->createPermission($cate);
|
|
});
|
|
}
|
|
}
|