koel/app/Http/Controllers/API/Interaction/RecentlyPlayedController.php

26 lines
718 B
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers\API\Interaction;
2022-06-10 10:47:46 +00:00
use App\Models\User;
use App\Repositories\InteractionRepository;
use App\Services\InteractionService;
2020-10-26 15:29:29 +00:00
use Illuminate\Contracts\Auth\Authenticatable;
class RecentlyPlayedController extends Controller
{
2022-06-10 10:47:46 +00:00
/** @param User $user */
2020-10-26 15:29:29 +00:00
public function __construct(
2022-06-10 10:47:46 +00:00
protected InteractionService $interactionService,
protected InteractionRepository $interactionRepository,
protected ?Authenticatable $user
2020-10-26 15:29:29 +00:00
) {
2022-06-10 10:47:46 +00:00
parent::__construct($interactionService, $user);
}
2020-10-26 15:29:29 +00:00
public function index(?int $count = null)
{
2022-06-10 10:47:46 +00:00
return response()->json($this->interactionRepository->getRecentlyPlayed($this->user, $count));
}
}