2024-08-30 06:16:16 +02:00
|
|
|
<?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([
|
2024-08-30 09:40:57 +02:00
|
|
|
'ids' => $ids,
|
2024-08-30 06:16:16 +02:00
|
|
|
], [
|
|
|
|
'ids' => 'required|array|min:1',
|
2024-08-30 09:40:57 +02:00
|
|
|
'ids.*' => 'required|uuid|distinct',
|
2024-08-30 06:16:16 +02:00
|
|
|
]);
|
|
|
|
if ($validator->fails()) {
|
|
|
|
throw new HttpResponseException(response()->json($validator->errors(), 422));
|
|
|
|
}
|
2024-08-30 09:40:57 +02:00
|
|
|
|
2024-08-30 06:16:16 +02:00
|
|
|
return $ids;
|
|
|
|
}
|
|
|
|
}
|