license: built full stack, test and documentation
This commit is contained in:
33
backend/app/Http/Requests/IndexLicenseRequest.php
Normal file
33
backend/app/Http/Requests/IndexLicenseRequest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user