]> BookStack Code Mirror - bookstack/blob - database/factories/Uploads/AttachmentFactory.php
respective book and chapter structure added.
[bookstack] / database / factories / Uploads / AttachmentFactory.php
1 <?php
2
3 namespace Database\Factories\Uploads;
4
5 use BookStack\Entities\Models\Page;
6 use BookStack\Users\Models\User;
7 use Illuminate\Database\Eloquent\Factories\Factory;
8
9 /**
10  * @extends \Illuminate\Database\Eloquent\Factories\Factory<\BookStack\Uploads\Attachment>
11  */
12 class AttachmentFactory extends Factory
13 {
14     /**
15      * The name of the factory's corresponding model.
16      *
17      * @var string
18      */
19     protected $model = \BookStack\Uploads\Attachment::class;
20
21     /**
22      * Define the model's default state.
23      *
24      * @return array<string, mixed>
25      */
26     public function definition()
27     {
28         return [
29             'name' => $this->faker->words(2, true),
30             'path' => $this->faker->url(),
31             'extension' => '',
32             'external' => true,
33             'uploaded_to' => Page::factory(),
34             'created_by' => User::factory(),
35             'updated_by' => User::factory(),
36             'order' => 0,
37         ];
38     }
39 }