feat: vcard services for import/export (#1996)

Improve CardDAV with write functions
This commit is contained in:
Alexis Saettler
2018-11-11 16:24:52 +01:00
committed by GitHub
parent 566b0b1348
commit 6c8a8ea9a9
37 changed files with 2213 additions and 1494 deletions
+8 -3
View File
@@ -5,11 +5,11 @@ namespace App\Http\Controllers;
use App\Helpers\DateHelper;
use App\Jobs\ResizeAvatars;
use App\Models\Contact\Tag;
use App\Helpers\VCardHelper;
use Illuminate\Http\Request;
use App\Helpers\AvatarHelper;
use App\Helpers\SearchHelper;
use App\Models\Contact\Contact;
use App\Services\VCard\ExportVCard;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use App\Models\Relationship\Relationship;
@@ -556,9 +556,14 @@ class ContactsController extends Controller
Debugbar::disable();
}
$vcard = VCardHelper::prepareVCard($contact);
$vcard = (new ExportVCard)->execute([
'account_id' => auth()->user()->account_id,
'contact_id' => $contact->id,
]);
return $vcard->download();
return response($vcard->serialize())
->header('Content-type', 'text/x-vcard')
->header('Content-Disposition', 'attachment; filename='.str_slug($contact->name).'.vcf');
}
/**