]> BookStack Code Mirror - bookstack/blob - database/factories/ModelFactory.php
Fixes padding issues of the sidebar's items
[bookstack] / database / factories / ModelFactory.php
1 <?php
2
3 /*
4 |--------------------------------------------------------------------------
5 | Model Factories
6 |--------------------------------------------------------------------------
7 |
8 | Here you may define all of your model factories. Model factories give
9 | you a convenient way to create models for testing and seeding your
10 | database. Just tell the factory how a default model should look.
11 |
12 */
13
14 $factory->define(\BookStack\Auth\User::class, function ($faker) {
15     $name = $faker->name;
16
17     return [
18         'name'            => $name,
19         'email'           => $faker->email,
20         'slug'            => \Illuminate\Support\Str::slug($name . '-' . \Illuminate\Support\Str::random(5)),
21         'password'        => Str::random(10),
22         'remember_token'  => Str::random(10),
23         'email_confirmed' => 1,
24     ];
25 });
26
27 $factory->define(\BookStack\Entities\Models\Bookshelf::class, function ($faker) {
28     return [
29         'name'        => $faker->sentence,
30         'slug'        => Str::random(10),
31         'description' => $faker->paragraph,
32     ];
33 });
34
35 $factory->define(\BookStack\Entities\Models\Book::class, function ($faker) {
36     return [
37         'name'        => $faker->sentence,
38         'slug'        => Str::random(10),
39         'description' => $faker->paragraph,
40     ];
41 });
42
43 $factory->define(\BookStack\Entities\Models\Chapter::class, function ($faker) {
44     return [
45         'name'        => $faker->sentence,
46         'slug'        => Str::random(10),
47         'description' => $faker->paragraph,
48     ];
49 });
50
51 $factory->define(\BookStack\Entities\Models\Page::class, function ($faker) {
52     $html = '<p>' . implode('</p>', $faker->paragraphs(5)) . '</p>';
53
54     return [
55         'name'           => $faker->sentence,
56         'slug'           => Str::random(10),
57         'html'           => $html,
58         'text'           => strip_tags($html),
59         'revision_count' => 1,
60     ];
61 });
62
63 $factory->define(\BookStack\Auth\Role::class, function ($faker) {
64     return [
65         'display_name' => $faker->sentence(3),
66         'description'  => $faker->sentence(10),
67     ];
68 });
69
70 $factory->define(\BookStack\Actions\Tag::class, function ($faker) {
71     return [
72         'name'  => $faker->city,
73         'value' => $faker->sentence(3),
74     ];
75 });
76
77 $factory->define(\BookStack\Uploads\Image::class, function ($faker) {
78     return [
79         'name'        => $faker->slug . '.jpg',
80         'url'         => $faker->url,
81         'path'        => $faker->url,
82         'type'        => 'gallery',
83         'uploaded_to' => 0,
84     ];
85 });
86
87 $factory->define(\BookStack\Actions\Comment::class, function ($faker) {
88     $text = $faker->paragraph(1);
89     $html = '<p>' . $text . '</p>';
90
91     return [
92         'html'      => $html,
93         'text'      => $text,
94         'parent_id' => null,
95     ];
96 });