add school calendar logic
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Settings;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class SchoolCalendarIndexRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'school_year' => ['nullable', 'string', 'max:20'],
|
||||
'semester' => ['nullable', 'string', 'max:20'],
|
||||
'audience' => ['nullable', 'string', Rule::in(['parent', 'teacher', 'admin'])],
|
||||
'include_meetings' => ['nullable', 'boolean'],
|
||||
'sort_dir' => ['nullable', 'string', Rule::in(['asc', 'desc'])],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Settings;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
|
||||
class SchoolCalendarOptionsRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Settings;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use App\Services\Settings\SchoolCalendar\SchoolCalendarContextService;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class SchoolCalendarStoreRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$eventTypes = app(SchoolCalendarContextService::class)->eventTypes();
|
||||
|
||||
return [
|
||||
'title' => ['required', 'string', 'min:3', 'max:255'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'event_type' => ['nullable', 'string', Rule::in($eventTypes)],
|
||||
'date' => ['required', 'date_format:Y-m-d'],
|
||||
'notify_parent' => ['nullable', 'boolean'],
|
||||
'notify_teacher' => ['nullable', 'boolean'],
|
||||
'notify_admin' => ['nullable', 'boolean'],
|
||||
'no_school' => ['nullable', 'boolean'],
|
||||
'school_year' => ['nullable', 'string', 'max:20'],
|
||||
'semester' => ['nullable', 'string', 'max:20'],
|
||||
'send_email_parent' => ['nullable', 'boolean'],
|
||||
'send_email_teacher' => ['nullable', 'boolean'],
|
||||
'send_email_admin' => ['nullable', 'boolean'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Settings;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use App\Services\Settings\SchoolCalendar\SchoolCalendarContextService;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class SchoolCalendarUpdateRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$eventTypes = app(SchoolCalendarContextService::class)->eventTypes();
|
||||
|
||||
return [
|
||||
'title' => ['sometimes', 'string', 'min:3', 'max:255'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'event_type' => ['nullable', 'string', Rule::in($eventTypes)],
|
||||
'date' => ['sometimes', 'date_format:Y-m-d'],
|
||||
'notify_parent' => ['nullable', 'boolean'],
|
||||
'notify_teacher' => ['nullable', 'boolean'],
|
||||
'notify_admin' => ['nullable', 'boolean'],
|
||||
'no_school' => ['nullable', 'boolean'],
|
||||
'school_year' => ['nullable', 'string', 'max:20'],
|
||||
'semester' => ['nullable', 'string', 'max:20'],
|
||||
'send_email_parent' => ['nullable', 'boolean'],
|
||||
'send_email_teacher' => ['nullable', 'boolean'],
|
||||
'send_email_admin' => ['nullable', 'boolean'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user