diff --git a/app/Services/ProfileService.php b/app/Services/ProfileService.php new file mode 100644 index 00000000..1ef93feb --- /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