2022-06-10 10:47:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\V6\API;
|
|
|
|
|
2022-07-29 06:47:10 +00:00
|
|
|
use App\Http\Controllers\Controller;
|
2022-06-10 10:47:46 +00:00
|
|
|
use App\Http\Resources\ArtistResource;
|
|
|
|
use App\Models\Artist;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Repositories\ArtistRepository;
|
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
|
|
|
|
|
|
class ArtistController extends Controller
|
|
|
|
{
|
|
|
|
/** @param User $user */
|
2022-08-09 18:45:11 +00:00
|
|
|
public function __construct(private ArtistRepository $repository, private ?Authenticatable $user)
|
2022-07-27 15:32:36 +00:00
|
|
|
{
|
2022-06-10 10:47:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
2022-08-09 18:45:11 +00:00
|
|
|
return ArtistResource::collection($this->repository->paginate($this->user));
|
2022-06-10 10:47:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function show(Artist $artist)
|
|
|
|
{
|
2022-08-09 18:45:11 +00:00
|
|
|
return ArtistResource::make($this->repository->getOne($artist->id, $this->user));
|
2022-06-10 10:47:46 +00:00
|
|
|
}
|
|
|
|
}
|