2018-10-20 21:46:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API\Interaction;
|
|
|
|
|
2022-06-10 10:47:46 +00:00
|
|
|
use App\Models\User;
|
2018-10-20 21:46:12 +00:00
|
|
|
use App\Repositories\InteractionRepository;
|
|
|
|
use App\Services\InteractionService;
|
2020-10-26 15:29:29 +00:00
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
2018-10-20 21:46:12 +00:00
|
|
|
|
|
|
|
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);
|
2018-10-20 21:46:12 +00:00
|
|
|
}
|
|
|
|
|
2020-10-26 15:29:29 +00:00
|
|
|
public function index(?int $count = null)
|
2018-10-20 21:46:12 +00:00
|
|
|
{
|
2022-06-10 10:47:46 +00:00
|
|
|
return response()->json($this->interactionRepository->getRecentlyPlayed($this->user, $count));
|
2018-10-20 21:46:12 +00:00
|
|
|
}
|
|
|
|
}
|