Created
April 30, 2015 09:58
-
-
Save naneri/df492629e9592cb0ac60 to your computer and use it in GitHub Desktop.
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 | |
// Composer: "fzaninotto/faker": "v1.3.0" | |
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