diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index a6371868..379dfca7 100755 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -21,6 +21,7 @@ use Illuminate\Support\Facades\Mail; use Symfony\Component\HttpFoundation\Response as ResponseAlias; use Tymon\JWTAuth\Facades\JWTAuth; +use Tymon\JWTAuth\JWT; class UserController extends Controller { @@ -119,11 +120,11 @@ public function followUser(Request $request) * The logic to get who to follow is undecided yet * For now, this just returns the latest five unfollowed users in the database */ - public function getWhoToFollow() + public function getWhoToFollow(Request $request, JWT $jwtAuth) { /** @phpstan-ignore-next-line */ - return ($user = JWTAuth::parseToken()->user()) ? - $this->getWhoToFollowData($user) : + return ($jwtAuth->parseToken()->check()) ? + $this->getWhoToFollowData($request->user()) : $this->unauthorizedResponse(); } diff --git a/app/Services/UserService.php b/app/Services/UserService.php index 02bd40d8..ae3f2051 100755 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -109,8 +109,8 @@ public function update(Request $request, string $option) public function findWhere($q) { return User::with(['cookbooks', 'recipes']) - ->where('id', $q) - ->orWhere('email', $q) - ->orWhere('name_slug', $q); + ->where('id', '=', $q) + ->orWhere('email', '=', $q) + ->orWhere('name_slug', '=', $q); } }