Alex Thomassen
9a4030f19a
Add login with username instead of email Add blog post seeder with Factory
24 lines
380 B
PHP
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()
|
|
);
|
|
});
|
|
}
|
|
}
|