]> BookStack Code Mirror - bookstack/blob - database/factories/ModelFactory.php
Update settings.php
[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     return [
16         'name' => $faker->name,
17         'email' => $faker->email,
18         'password' => Str::random(10),
19         'remember_token' => Str::random(10),
20         'email_confirmed' => 1
21     ];
22 });
23
24 $factory->define(\BookStack\Entities\Bookshelf::class, function ($faker) {
25     return [
26         'name' => $faker->sentence,
27         'slug' => Str::random(10),
28         'description' => $faker->paragraph
29     ];
30 });
31
32 $factory->define(\BookStack\Entities\Book::class, function ($faker) {
33     return [
34         'name' => $faker->sentence,
35         'slug' => Str::random(10),
36         'description' => $faker->paragraph
37     ];
38 });
39
40 $factory->define(\BookStack\Entities\Chapter::class, function ($faker) {
41     return [
42         'name' => $faker->sentence,
43         'slug' => Str::random(10),
44         'description' => $faker->paragraph
45     ];
46 });
47
48 $factory->define(\BookStack\Entities\Page::class, function ($faker) {
49     $html = '<p>' . implode('</p>', $faker->paragraphs(5)) . '</p>';
50     return [
51         'name' => $faker->sentence,
52         'slug' => Str::random(10),
53         'html' => $html,
54         'text' => strip_tags($html),
55         'revision_count' => 1
56     ];
57 });
58
59 $factory->define(\BookStack\Auth\Role::class, function ($faker) {
60     return [
61         'display_name' => $faker->sentence(3),
62         'description' => $faker->sentence(10)
63     ];
64 });
65
66 $factory->define(\BookStack\Actions\Tag::class, function ($faker) {
67     return [
68         'name' => $faker->city,
69         'value' => $faker->sentence(3)
70     ];
71 });
72
73 $factory->define(\BookStack\Uploads\Image::class, function ($faker) {
74     return [
75         'name' => $faker->slug . '.jpg',
76         'url' => $faker->url,
77         'path' => $faker->url,
78         'type' => 'gallery',
79         'uploaded_to' => 0
80     ];
81 });
82
83 $factory->define(\BookStack\Actions\Comment::class, function($faker) {
84     $text = $faker->paragraph(1);
85     $html = '<p>' . $text. '</p>';
86     return [
87         'html' => $html,
88         'text' => $text,
89         'parent_id' => null
90     ];
91 });