$email], [ 'firstname' => $firstname, 'lastname' => $lastname, 'timezone' => $timezone, 'password' => Hash::make($password), ] ); /** fill the sabre-friendly columns */ $user->update([ 'uri' => 'principals/'.$user->email, 'displayname' => $firstname.' '.$lastname, ]); /** sample caldav data */ $calId = DB::table('calendars')->insertGetId([ 'synctoken' => 1, 'components' => 'VEVENT', ]); $instanceId = DB::table('calendarinstances')->insertGetId([ 'calendarid' => $calId, 'principaluri' => $user->uri, // uses new column 'uri' => Str::uuid(), 'displayname' => 'Sample Calendar', 'description' => 'Seeded calendar', 'calendarorder' => 0, 'calendarcolor' => '#007db6', 'timezone' => config('app.timezone', 'UTC'), ]); DB::table('calendar_meta')->updateOrInsert( ['calendar_id' => $instanceId], ['color' => '#007AFF'] ); /** sample vevent */ $uid = Str::uuid().'@kithkin.lan'; $start = Carbon::now(); $end = Carbon::now()->addHour(); $ical = <<utc()->format('Ymd\\THis\\Z')} DTSTART:{$start->format('Ymd\\THis')} DTEND:{$end->format('Ymd\\THis')} SUMMARY:Seed Event DESCRIPTION:Automatically seeded event LOCATION:Home Office END:VEVENT END:VCALENDAR ICS; $eventId = DB::table('calendarobjects')->insertGetId([ 'calendarid' => $calId, 'uri' => Str::uuid().'.ics', 'lastmodified' => time(), 'etag' => md5($ical), 'size' => strlen($ical), 'componenttype' => 'VEVENT', 'uid' => $uid, 'calendardata' => $ical, ]); DB::table('event_meta')->updateOrInsert( ['event_id' => $eventId], [ 'title' => 'Seed Event', 'description' => 'Automatically seeded event', 'location' => 'Home Office', 'all_day' => false, 'category' => 'Demo', 'start_at' => $start, 'end_at' => $end, 'created_at' => now(), 'updated_at' => now(), ] ); /** create cards */ $bookId = DB::table('addressbooks')->insertGetId([ 'principaluri' => $user->uri, 'uri' => 'default', 'displayname' => 'Default Address Book', ]); $vcard = <<insert([ 'addressbook_id' => $bookId, 'color' => '#ff40ff', 'is_default' => true, 'settings' => null, 'created_at' => now(), 'updated_at' => now(), ]); $cardId = DB::table('cards')->insertGetId([ 'addressbookid' => $bookId, 'uri' => Str::uuid().'.vcf', 'lastmodified' => now()->timestamp, 'etag' => md5($vcard), 'size' => strlen($vcard), 'carddata' => $vcard, ]); DB::table('contact_meta')->insert([ 'card_id' => $cardId, 'avatar_url' => null, 'tags' => 'demo,seed', 'notes' => 'Seeded contact from DatabaseSeeder.', 'created_at' => now(), 'updated_at' => now(), ]); } }