From 4ca5a9e74212d9823a0ae77b164fb1561b80dd3c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 3 Jun 2018 19:39:38 -0600 Subject: [PATCH] Add ApiController --- app/Http/Controllers/ApiController.php | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/Http/Controllers/ApiController.php diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php new file mode 100644 index 000000000..1b52e28f2 --- /dev/null +++ b/app/Http/Controllers/ApiController.php @@ -0,0 +1,32 @@ +middleware('auth'); + } + + public function hydrateLikes(Request $request) + { + $this->validate($request, [ + 'min' => 'nullable|integer|min:1', + 'max' => 'nullable|integer', + ]); + + $profile = Auth::user()->profile; + + $likes = Like::whereProfileId($profile->id) + ->orderBy('id', 'desc') + ->take(100) + ->pluck('status_id'); + + return response()->json($likes); + } +}