Update AccountService, fixes #1834

This commit is contained in:
Daniel Supernault 2019-11-27 19:20:41 -07:00
parent 5b8d2c4418
commit eb478ccf76
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -14,16 +14,16 @@ class AccountService {
public static function get($id)
{
$key = self::CACHE_KEY . ':' . $id;
$ttl = now()->addHours(12);
// $key = self::CACHE_KEY . ':' . $id;
// $ttl = now()->addSeconds(10);
// return Cache::remember($key, $ttl, function() use($id) {
// });
return Cache::remember($key, $ttl, function() use($id) {
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$profile = Profile::whereNull('status')->findOrFail($id);
$resource = new Fractal\Resource\Item($profile, new AccountTransformer());
return $fractal->createData($resource)->toArray();
});
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$profile = Profile::whereNull('status')->findOrFail($id);
$resource = new Fractal\Resource\Item($profile, new AccountTransformer());
return $fractal->createData($resource)->toArray();
}
}