Skip to content

Commit

Permalink
optimisation demo seeder completed
Browse files Browse the repository at this point in the history
  • Loading branch information
carduz committed Dec 14, 2015
1 parent d74de53 commit 7f50a77
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ RewriteCond %{REQUEST_FILENAME} !update.php
RewriteCond %{REQUEST_FILENAME} !routes.php
RewriteCond %{REQUEST_FILENAME} !sync.php
RewriteCond %{REQUEST_FILENAME} !optimise.php
RewriteCond %{REQUEST_FILENAME} !optimiseDemo.php
RewriteRule ^ public/ [L]
8 changes: 6 additions & 2 deletions database/seeds/OptimisationDemoSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public function run()

static private function simpleModel()
{
$company = factory(\plunner\Company::class)->create();
$employees = factory(\plunner\Employee::class, 3)->make()->each(function ($employee) use($company){
$company = factory(\plunner\Company::class)->create(['password' => bcrypt('test')]);
$employees = factory(\plunner\Employee::class, 3)->make(['password' => bcrypt('test')])->each(function ($employee) use($company){
$company->employees()->save($employee);
$employee->calendars()->save(factory(\plunner\Calendar::class)->make());
});
Expand Down Expand Up @@ -49,6 +49,10 @@ static private function simpleModel()
$employee->calendars()->first()->timeslots()->create($timeslotsE);
});
$employeeNo->calendars()->first()->timeslots()->create($timeslotsENo);

print_r($company->toArray());
print_r($employees->toArray());
print_r($employeeNo->toArray());
}

/**
Expand Down
3 changes: 3 additions & 0 deletions optimiseDemo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
system('php artisan db:seed --class=OptimisationDemoSeeder --force');
?>

0 comments on commit 7f50a77

Please sign in to comment.