Files
mtdb_movie/app/Http/Controllers/PersonCreditsController.php
T
maher 511fad8199
Build / run (push) Has been cancelled
Initial commit
2026-05-14 13:42:10 +02:00

31 lines
726 B
PHP
Executable File

<?php
namespace App\Http\Controllers;
use App\Actions\People\GetPersonCredits;
use App\Models\Person;
use Common\Core\BaseController;
use Illuminate\Support\Arr;
class PersonCreditsController extends BaseController
{
public function fullTitleCredits(
Person $person,
int $titleId,
string $department,
) {
$this->authorize('show', Person::class);
$credits = app(GetPersonCredits::class)->execute($person, [
'titleId' => $titleId,
]);
$title = Arr::first(
$credits['credits'][$department],
fn($title) => $title['id'] === (int) $titleId,
);
return $this->success(['credits' => $title['episodes']]);
}
}