items, $identification); } else { Arr::where((array) $this->items, function($key, $value) use ($identification, $type) { return ($user->$type == $identification); }); } } /** * Get a user from repository and cache it. * * @param string $identification * @param string $type * @return mixed */ public function get($identification, $type = 'uid') { if (!$this->has($identification, $type)) { if ($type == "username") { $player = Player::where('player_name', $identification)->first(); if ($player) { $identification = $player->uid; $type = "uid"; } } $user = User::where($type, $identification)->first(); if ($user) { $this->set($user->uid, $user); return $user; } } return Arr::get($this->items, $identification, null); } }