/** * Get an access gate instance. * * @param \User $user * @return \Illuminate\Auth\Access\Gate */ protected function gate(User $user) { $gate = new Gate(new Container(), function () use($user) { return $user; }); $this->clipboard->registerAt($gate); return $gate; }
/** * Get the user's roles from the given cache instance through the clipboard. * * @param \Illuminate\Cache\ArrayStore $cache * @param \Illuminate\Database\Eloquent\Model $user * @return array */ protected function getRoles(ArrayStore $cache, Model $user) { $clipboard = new CachedClipboard($cache); return $clipboard->getRoles($user)->all(); }
/** * Clear the cache for the given user. * * @param \Illuminate\Database\Eloquent\Model $user * @return $this */ public function refreshFor(Model $user) { $this->clipboard->refreshFor($user); return $this; }