Skip to content

Instantly share code, notes, and snippets.

@naneri
Created April 30, 2015 09:57
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/3ff606f2efaf3646c6cc to your computer and use it in GitHub Desktop.
Save naneri/3ff606f2efaf3646c6cc to your computer and use it in GitHub Desktop.
<?php
use Faker\Factory as Faker;
class TeamsTableSeeder extends Seeder {
public function run()
{
DB::table('teams')->delete();
$faker = Faker::create();
$users = User::orderByRaw("RAND()")->take(10)->get();
foreach(range(1, 10) as $index)
{
$user = $users->pop();
Team::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