1.8 - Factory States

This commit is contained in:
Adam Wathan
2016-11-03 15:05:59 -04:00
parent 12e18f3728
commit a3d6a1efcd
2 changed files with 14 additions and 5 deletions

View File

@@ -39,3 +39,15 @@ $factory->define(App\Concert::class, function (Faker\Generator $faker) {
'additional_information' => 'Some sample additional information.',
];
});
$factory->state(App\Concert::class, 'published', function ($faker) {
return [
'published_at' => Carbon::parse('-1 week'),
];
});
$factory->state(App\Concert::class, 'unpublished', function ($faker) {
return [
'published_at' => null,
];
});