<?php

namespace Database\Factories;

use App\Models\PageSlug;
use Illuminate\Database\Eloquent\Factories\Factory;

use App\Models\Page;
use Illuminate\Support\Str;

class PageSlugFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = PageSlug::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        $page = Page::factory()->create();
        return [
            'slug' => Str::random(8),
            'pageable_id' => $page->id,
            'pageable_type' => get_class($page),
            'root' => false,
        ];
    }
}
