34 lines
630 B
PHP
34 lines
630 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Page;
|
|
use App\Models\PageLink;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<PageLink>
|
|
*/
|
|
class PageLinkFactory extends Factory
|
|
{
|
|
public function definition(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function withSource(Page $page): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'source_page_id' => $page->id,
|
|
]);
|
|
}
|
|
|
|
public function withTarget(Page $page): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'target_page_id' => $page->id,
|
|
]);
|
|
}
|
|
}
|