add all controllers logic
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Classes;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ClassSectionUpdateRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$section = $this->route('classSection');
|
||||
$sectionId = is_object($section) ? $section->id : $section;
|
||||
|
||||
return [
|
||||
'class_id' => ['sometimes', 'integer', 'min:1'],
|
||||
'class_section_id' => [
|
||||
'sometimes',
|
||||
'integer',
|
||||
'min:1',
|
||||
Rule::unique('classSection', 'class_section_id')->ignore($sectionId),
|
||||
],
|
||||
'class_section_name' => ['sometimes', 'string', 'max:100'],
|
||||
'semester' => ['sometimes', 'string', 'max:255'],
|
||||
'school_year' => ['sometimes', 'string', 'max:9'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user