| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace App\Http\Requests;
- use Illuminate\Foundation\Http\FormRequest;
- class ClassRequest extends FormRequest
- {
- public function authorize(): bool
- {
- return true;
- }
- public function rules(): array
- {
- $required = $this->isMethod('POST') ? 'required' : 'sometimes';
- return [
- 'title' => "{$required}|string|max:255",
- 'class_package_unit_id' => "{$required}|integer|exists:class_package_units,id",
- 'instructor' => 'nullable|string|max:255',
- 'room' => 'nullable|string|max:255',
- 'date_time_start' => "{$required}|date",
- 'date_time_end' => "{$required}|date|after:date_time_start",
- 'status' => 'sometimes|string|max:50',
- ];
- }
- /**
- * Add custom messages when needed
- * public function messages(): array
- * {
- * return [
- * 'field.required' => __('message.algo'),
- * ];
- * }
- */
- }
|