From 043b3b51dd4e08e02bf9757e24cdda87293d8c37 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 23 Sep 2019 19:08:45 -0600 Subject: [PATCH] Update BaseApiController, add source to verify_credentials endpoint --- app/Http/Controllers/Api/BaseApiController.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/BaseApiController.php b/app/Http/Controllers/Api/BaseApiController.php index f33b6e0f..7874ed2d 100644 --- a/app/Http/Controllers/Api/BaseApiController.php +++ b/app/Http/Controllers/Api/BaseApiController.php @@ -306,7 +306,15 @@ class BaseApiController extends Controller $res = Cache::remember('user:account:id:'.$id, now()->addHours(6), function() use($id) { $profile = Profile::whereNull('status')->whereUserId($id)->firstOrFail(); $resource = new Fractal\Resource\Item($profile, new AccountTransformer()); - return $this->fractal->createData($resource)->toArray(); + $res = $this->fractal->createData($resource)->toArray(); + $res['source'] = [ + 'privacy' => $profile->is_private ? 'private' : 'public', + 'sensitive' => $profile->cw ? true : false, + 'language' => 'en', + 'note' => '', + 'fields' => [] + ]; + return $res; }); return response()->json($res);