34 lines
850 B
PHP
34 lines
850 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class IndexLicenseRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Rotta pubblica: l'elenco delle licenze è informazione pubblica.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* `scope` filtra le select dei form: `record` per artifact/model (solo
|
|
* licenze aperte), `media` per i file caricati (tutte). `active` esclude
|
|
* le licenze ritirate dagli admin.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'scope' => ['nullable', Rule::in(['record', 'media'])],
|
|
'active' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
}
|