1
0
Fork 0
pixelfed/app/Http/Controllers/ApiController.php

36 lines
877 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
{
2019-02-25 18:56:24 +00:00
// todo: deprecate and remove
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;
2019-02-25 18:56:24 +00:00
$res = Cache::remember('api:like-ids:user:'.$profile->id, now()->addDays(1), 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
}
}