mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 16:24:29 +00:00
Add ApiController
This commit is contained in:
parent
4f93a4044e
commit
4ca5a9e742
1 changed files with 32 additions and 0 deletions
32
app/Http/Controllers/ApiController.php
Normal file
32
app/Http/Controllers/ApiController.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use App\Like;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue