feat: establish reservation portal foundation
This commit is contained in:
27
app/Http/Requests/StoreReservationRequest.php
Normal file
27
app/Http/Requests/StoreReservationRequest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreReservationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user()?->active === true;
|
||||
}
|
||||
|
||||
/** @return array<string, list<string>> */
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'purpose' => ['required', 'string', 'min:10', 'max:2000'],
|
||||
'usage_location' => ['required', 'string', 'max:255'],
|
||||
'starts_at' => ['required', 'date', 'after:now'],
|
||||
'ends_at' => ['required', 'date', 'after:starts_at'],
|
||||
'asset_ids' => ['required', 'array', 'min:1', 'max:10'],
|
||||
'asset_ids.*' => ['required', 'integer', 'distinct', 'exists:snipe_assets,id'],
|
||||
'terms_accepted' => ['accepted'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user