phpldapadmin/app/Http/Requests/EntryRequest.php

24 lines
496 B
PHP
Raw Normal View History

2023-03-31 15:55:08 +11:00
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class EntryRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, mixed>
*/
public function rules(): array
2023-03-31 15:55:08 +11:00
{
2023-04-12 23:18:26 +10:00
return config('server')
->schema('attributetypes')
->intersectByKeys($this->request)
->map(fn($item)=>$item->validation(request()?->get('objectclass') ?: []))
2023-04-12 23:18:26 +10:00
->filter()
->flatMap(fn($item)=>$item)
2023-04-12 23:18:26 +10:00
->toArray();
2023-03-31 15:55:08 +11:00
}
}