koel/app/Http/Controllers/API/LastfmController.php

32 lines
789 B
PHP
Raw Normal View History

2015-12-20 12:17:35 +00:00
<?php
namespace App\Http\Controllers\API;
2022-07-29 06:47:10 +00:00
use App\Http\Controllers\Controller;
use App\Http\Requests\API\LastfmSetSessionKeyRequest;
2020-09-06 18:21:39 +00:00
use App\Models\User;
use App\Services\LastfmService;
2020-09-06 18:21:39 +00:00
use Illuminate\Contracts\Auth\Authenticatable;
2015-12-20 12:17:35 +00:00
class LastfmController extends Controller
{
2022-07-29 06:47:10 +00:00
/** @param User $currentUser */
public function __construct(private LastfmService $lastfm, private ?Authenticatable $currentUser)
2018-09-04 06:25:24 +00:00
{
2015-12-20 12:17:35 +00:00
}
public function setSessionKey(LastfmSetSessionKeyRequest $request)
2016-01-26 06:32:29 +00:00
{
2022-07-29 06:47:10 +00:00
$this->lastfm->setUserSessionKey($this->currentUser, $request->key);
2016-01-26 06:32:29 +00:00
return response()->noContent();
2016-01-26 06:32:29 +00:00
}
2015-12-20 12:17:35 +00:00
public function disconnect()
{
$this->lastfm->setUserSessionKey($this->currentUser, null);
2018-09-04 02:25:34 +00:00
return response()->noContent();
2015-12-20 12:17:35 +00:00
}
}