select(['username', 'name', 'email', 'photo']); if ($username !== null) { $query->where('username', '=', $username); } $result = $query->get(); if (count($result) > 0) { return $result; } return null; } }