]> BookStack Code Mirror - bookstack/blob - database/factories/ModelFactory.php
Fixed role permission removal bug
[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\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\Book::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\Chapter::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\Page::class, function ($faker) {
41     $html = '<p>' . implode('</p>', $faker->paragraphs(5)) . '</p>';
42     return [
43         'name' => $faker->sentence,
44         'slug' => str_random(10),
45         'html' => $html,
46         'text' => strip_tags($html),
47         'revision_count' => 1
48     ];
49 });
50
51 $factory->define(BookStack\Role::class, function ($faker) {
52     return [
53         'display_name' => $faker->sentence(3),
54         'description' => $faker->sentence(10)
55     ];
56 });
57
58 $factory->define(BookStack\Tag::class, function ($faker) {
59     return [
60         'name' => $faker->city,
61         'value' => $faker->sentence(3)
62     ];
63 });
64
65 $factory->define(BookStack\Image::class, function ($faker) {
66     return [
67         'name' => $faker->slug . '.jpg',
68         'url' => $faker->url,
69         'path' => $faker->url,
70         'type' => 'gallery',
71         'uploaded_to' => 0
72     ];
73 });