Skip to content

Instantly share code, notes, and snippets.

@naneri
Created April 30, 2015 09:35
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 naneri/f2f889f517f2b4c0e83a to your computer and use it in GitHub Desktop.
Save naneri/f2f889f517f2b4c0e83a to your computer and use it in GitHub Desktop.
<?php
class CompaniesTableSeeder extends Seeder {
public function run()
{
DB::table('companies')->delete();
$faker = Faker\Factory::create();
foreach(range(1, 1000) as $index)
{
$users = User::orderByRaw("RAND()")->first();
Company::create([
'owner_id' => $user->id,
'name' => $faker->company,
'created_at' => $faker->dateTime($max = 'now')
]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment