Example #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     self::company();
     $company = ['name' => 'testInit', 'email' => '*****@*****.**', 'password' => bcrypt('test'), 'remember_token' => str_random(10)];
     $company = plunner\Company::create($company);
     self::employees($company);
     $employee = new \plunner\Employee(['name' => 'testEmp', 'email' => '*****@*****.**', 'password' => bcrypt('test'), 'remember_token' => str_random(10)]);
     $company->employees()->save($employee);
 }
Example #2
0
 private static function makeDataKnown()
 {
     //create company
     $company = ['name' => 'testInit', 'email' => '*****@*****.**', 'password' => bcrypt('test'), 'remember_token' => str_random(10)];
     $company = plunner\Company::create($company);
     //create employees
     self::employees($company);
     $employee = new \plunner\Employee(['name' => 'testEmp', 'email' => '*****@*****.**', 'password' => bcrypt('test'), 'remember_token' => str_random(10)]);
     $company->employees()->save($employee);
     self::calendars($employee);
     //create groups
     self::groups($company, $company->employees->toArray());
     //add caldav
     $calendar = $employee->calendars()->create(['name' => 'errors']);
     $calendar->caldav()->create(['url' => 'https://example.com', 'username' => '*****@*****.**', 'password' => Crypt::encrypt('wrong'), 'calendar_name' => 'test']);
     $examples = env('CALDAV_EXAMPLES', '[]');
     $examples = json_decode($examples, true);
     foreach ($examples as $example) {
         $example['password'] = Crypt::encrypt($example['password']);
         $employee->calendars()->create(['name' => 'caldavTes'])->caldav()->create($example);
     }
     //TODO seed caldavs for all users
 }