27 lines
767 B
PHP
27 lines
767 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Team;
|
|
|
|
use App\Models\Truck;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreTruckRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'plate_number' => ['required', 'string', 'max:16', Rule::unique('trucks', 'plate_number')->whereNull('deleted_at')],
|
|
'model' => ['nullable', 'string', 'max:100'],
|
|
'capacity_kg' => ['nullable', 'integer', 'min:0'],
|
|
'status' => ['nullable', Rule::in([Truck::STATUS_ACTIVE, Truck::STATUS_MAINTENANCE, Truck::STATUS_RETIRED])],
|
|
'notes' => ['nullable', 'string', 'max:1000'],
|
|
];
|
|
}
|
|
}
|