mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Update ApiController
This commit is contained in:
parent
1fb532995a
commit
57a565dbba
1 changed files with 13 additions and 10 deletions
|
@ -2,16 +2,13 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use App\Like;
|
||||
use Auth, Cache;
|
||||
use App\{Like, Status};
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Api\BaseApiController;
|
||||
|
||||
class ApiController extends Controller
|
||||
class ApiController extends BaseApiController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function hydrateLikes(Request $request)
|
||||
{
|
||||
|
@ -21,12 +18,18 @@ class ApiController extends Controller
|
|||
]);
|
||||
|
||||
$profile = Auth::user()->profile;
|
||||
|
||||
$likes = Like::whereProfileId($profile->id)
|
||||
$res = Cache::remember('api:like-ids:user:'.$profile->id, 1440, function() use ($profile) {
|
||||
return Like::whereProfileId($profile->id)
|
||||
->orderBy('id', 'desc')
|
||||
->take(1000)
|
||||
->pluck('status_id');
|
||||
});
|
||||
|
||||
return response()->json($likes);
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
public function loadMoreComments(Request $request)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue