Files
core/database/factories/ModelFactory.php

42 lines
1.3 KiB
PHP

<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
use App\CMS\Contracts\Repositories\Content as ContentContract;
use App\Models\Content\Content;
use App\Models\User;
use Carbon\Carbon;
$factory->define(User::class, function (Faker\Generator $faker) {
$email = $faker->email;
return [
'username' => $email,
'email' => $email,
'name' => $faker->name,
'password' => bcrypt(str_random(10)),
'role' => 'admin',
];
});
$factory->define(Content::class, function (Faker\Generator $faker) {
return [
'title' => $faker->sentence(5),
'userId' => 1,
'url' => $faker->slug(5),
'pageContent' => $faker->text(1500),
'metaDescription' => $faker->text,
'moduleHandler' => config('staticpages.handler'),
'language' => env('LOCALES'),
'publishedFrom' => Carbon::now(),
'status' => ContentContract::STATUS_PUBLIC
];
});