2018-06-04 01:39:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2018-08-10 05:04:21 +00:00
|
|
|
use Auth, Cache;
|
|
|
|
use App\{Like, Status};
|
2018-06-04 01:39:38 +00:00
|
|
|
use Illuminate\Http\Request;
|
2018-08-10 05:04:21 +00:00
|
|
|
use App\Http\Controllers\Api\BaseApiController;
|
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-10 05:04:21 +00:00
|
|
|
$res = Cache::remember('api:like-ids:user:'.$profile->id, 1440, function() use ($profile) {
|
|
|
|
return Like::whereProfileId($profile->id)
|
2018-06-04 01:39:38 +00:00
|
|
|
->orderBy('id', 'desc')
|
2018-06-04 03:04:01 +00:00
|
|
|
->take(1000)
|
2018-06-04 01:39:38 +00:00
|
|
|
->pluck('status_id');
|
2018-08-10 05:04:21 +00:00
|
|
|
});
|
2018-06-04 03:04:01 +00:00
|
|
|
|
2018-08-10 05:04:21 +00:00
|
|
|
return response()->json($res);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function loadMoreComments(Request $request)
|
|
|
|
{
|
|
|
|
return;
|
2018-06-04 01:39:38 +00:00
|
|
|
}
|
|
|
|
}
|