Update BaseApiController, uncache verify_credentials method

This commit is contained in:
Daniel Supernault 2019-10-17 00:16:12 -06:00
parent 49efaae96c
commit 3fa9ac8bd9
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -310,15 +310,8 @@ class BaseApiController extends Controller
{ {
$user = $request->user(); $user = $request->user();
abort_if(!$user, 403); abort_if(!$user, 403);
$id = $user->id; $resource = new Fractal\Resource\Item($user->profile, new AccountTransformer());
$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());
$res = $this->fractal->createData($resource)->toArray(); $res = $this->fractal->createData($resource)->toArray();
return $res;
});
return response()->json($res); return response()->json($res);
} }