Skip to content

Instantly share code, notes, and snippets.

@GhazanfarMir
Created June 5, 2016 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GhazanfarMir/5348f52f82ad07075c8055d464963bd3 to your computer and use it in GitHub Desktop.
Save GhazanfarMir/5348f52f82ad07075c8055d464963bd3 to your computer and use it in GitHub Desktop.
Seeding Articles in Laravel 5.2
<?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