24 lines
586 B
PHP
24 lines
586 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Requests;
|
||
|
|
||
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
||
|
|
||
|
class TrashGroupRequest extends AuthorizedRequest
|
||
|
{
|
||
|
public function getValidatedIds(): array
|
||
|
{
|
||
|
$ids = explode(',', $this->query('ids'));
|
||
|
$validator = validator([
|
||
|
'ids' => $ids
|
||
|
], [
|
||
|
'ids' => 'required|array|min:1',
|
||
|
'ids.*' => 'required|uuid|distinct'
|
||
|
]);
|
||
|
if ($validator->fails()) {
|
||
|
throw new HttpResponseException(response()->json($validator->errors(), 422));
|
||
|
}
|
||
|
return $ids;
|
||
|
}
|
||
|
}
|