1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-27 10:16:47 +00:00
pixelfed/app/Http/Controllers/ApiController.php

35 lines
830 B
PHP
Raw Normal View History

2018-06-04 01:39:38 +00:00
<?php
namespace App\Http\Controllers;
2018-08-10 05:04:21 +00:00
use App\Http\Controllers\Api\BaseApiController;
2018-08-28 03:07:36 +00:00
use App\Like;
use Auth;
use Cache;
use Illuminate\Http\Request;
2018-06-04 01:39:38 +00:00
2018-08-10 05:04:21 +00:00
class ApiController extends BaseApiController
2018-06-04 01:39:38 +00:00
{
public function hydrateLikes(Request $request)
{
$this->validate($request, [
'min' => 'nullable|integer|min:1',
'max' => 'nullable|integer',
]);
$profile = Auth::user()->profile;
2018-08-28 03:07:36 +00:00
$res = Cache::remember('api:like-ids:user:'.$profile->id, 1440, function () use ($profile) {
2018-08-10 05:04:21 +00:00
return Like::whereProfileId($profile->id)
2018-06-04 01:39:38 +00:00
->orderBy('id', 'desc')
->take(1000)
2018-06-04 01:39:38 +00:00
->pluck('status_id');
2018-08-10 05:04:21 +00:00
});
2018-08-10 05:04:21 +00:00
return response()->json($res);
}
public function loadMoreComments(Request $request)
{
2018-06-04 01:39:38 +00:00
}
}