HovedprosjektWebApp/database/seeds/BlogPostSeeder.php
Alex Thomassen 9a4030f19a
Add view for posts
Add login with username instead of email

Add blog post seeder with Factory
2020-03-05 13:36:17 +01:00

24 lines
380 B
PHP

<?php
use Illuminate\Database\Seeder;
use App\BlogPost;
use App\User;
class BlogPostSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
User::all()->each(function ($user) {
$user->posts()->save(
factory(BlogPost::class)->make()
);
});
}
}