]> BookStack Code Mirror - bookstack/blob - database/factories/ModelFactory.php
Fixes #45
[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     ];
21 });
22
23 $factory->define(BookStack\Book::class, function ($faker) {
24     return [
25         'name' => $faker->sentence,
26         'slug' => str_random(10),
27         'description' => $faker->paragraph
28     ];
29 });
30
31 $factory->define(BookStack\Chapter::class, function ($faker) {
32     return [
33         'name' => $faker->sentence,
34         'slug' => str_random(10),
35         'description' => $faker->paragraph
36     ];
37 });
38
39 $factory->define(BookStack\Page::class, function ($faker) {
40     $html = '<p>' . implode('</p>', $faker->paragraphs(5)) . '</p>';
41     return [
42         'name' => $faker->sentence,
43         'slug' => str_random(10),
44         'html' => $html,
45         'text' => strip_tags($html)
46     ];
47 });