add projet
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class IndexAdminProgressRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
// Replace with your policy/permission logic
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'from' => ['nullable', 'date'],
|
||||
'to' => ['nullable', 'date'],
|
||||
'class_section_id' => ['nullable', 'integer'],
|
||||
'status' => [
|
||||
'nullable',
|
||||
'string',
|
||||
Rule::in(array_keys(config('progress.status_options', []))),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'from' => $this->filled('from') ? (string) $this->query('from') : '',
|
||||
'to' => $this->filled('to') ? (string) $this->query('to') : '',
|
||||
'class_section_id' => $this->filled('class_section_id') ? (string) $this->query('class_section_id') : '',
|
||||
'status' => $this->filled('status') ? (string) $this->query('status') : '',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user