Created
June 5, 2016 12:23
-
-
Save GhazanfarMir/5348f52f82ad07075c8055d464963bd3 to your computer and use it in GitHub Desktop.
Seeding Articles in Laravel 5.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Seeder; | |
use Faker\Factory as Faker; | |
use App\Article; | |
class ArticlesTableSeeder extends Seeder { | |
/** | |
* Run the database seeds. | |
* | |
* @return void | |
*/ | |
public function run() { | |
$faker = Faker::create(); | |
foreach (range(1, 100) as $i) { | |
Article::create([ | |
'title' => $faker->sentence(5), | |
'body' => $faker->paragraph(4) | |
]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment