30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Topology;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class IndexTopologyRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'search' => ['nullable', 'string', 'max:255'],
|
|
'status' => ['nullable', 'string', 'max:30'],
|
|
'device_type_id' => ['nullable', 'integer', 'exists:topology_device_types,id'],
|
|
'link_type' => ['nullable', Rule::in(['fiber', 'wireless', 'ethernet', 'logical'])],
|
|
'bbox' => ['nullable', 'regex:/^-?\d+(\.\d+)?,-?\d+(\.\d+)?,-?\d+(\.\d+)?,-?\d+(\.\d+)?$/'],
|
|
'page' => ['nullable', 'integer', 'min:1'],
|
|
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
|
'sort_by' => ['nullable', Rule::in(['id', 'code', 'name', 'status', 'category', 'link_type', 'installed_at', 'created_at'])],
|
|
'sort_direction' => ['nullable', Rule::in(['asc', 'desc'])],
|
|
];
|
|
}
|
|
}
|