From 896012bcaa66cce183cd218abb907038316cecdd Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 14 Feb 2019 14:23:33 -0700 Subject: [PATCH] Add ProfileService --- app/Services/ProfileService.php | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 app/Services/ProfileService.php diff --git a/app/Services/ProfileService.php b/app/Services/ProfileService.php new file mode 100644 index 000000000..1ef93febb --- /dev/null +++ b/app/Services/ProfileService.php @@ -0,0 +1,43 @@ +profile = $profile; + $this->profile_prefix = 'profile:model:'.$profile->id; + return $this; + } + + public function profileId($id) + { + return Cache::rememberForever('profile:model:'.$id, function() use($id) { + return Profile::findOrFail($id); + }); + } + + public function get() + { + return Cache::rememberForever($this->profile_prefix, function() { + return $this->profile; + }); + } + +} \ No newline at end of file