src/Http/Requests/LibraryDeleteRequest.php
<?php
namespace EscolaLms\HeadlessH5P\Http\Requests;
use EscolaLms\HeadlessH5P\Repositories\Contracts\H5PContentRepositoryContract;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
class LibraryDeleteRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
$h5PContentRepository = app(H5PContentRepositoryContract::class);
$h5pLibrary = $h5PContentRepository->getLibraryById($this->route('id'));
return Gate::allows('delete', $h5pLibrary);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [];
}
}