add all controllers logic
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Preferences;
|
||||
|
||||
use App\Http\Requests\ApiFormRequest;
|
||||
use App\Services\Preferences\PreferencesOptionsService;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class PreferencesUpsertRequest extends ApiFormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return $this->user() !== null;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$options = app(PreferencesOptionsService::class);
|
||||
|
||||
return [
|
||||
'receive_email_notifications' => ['nullable', 'boolean'],
|
||||
'receive_sms_notifications' => ['nullable', 'boolean'],
|
||||
'notification_email' => ['nullable', 'boolean'],
|
||||
'notification_sms' => ['nullable', 'boolean'],
|
||||
'theme' => ['nullable', 'string', Rule::in(['light', 'dark'])],
|
||||
'language' => ['nullable', 'string', Rule::in(['en', 'fr', 'es'])],
|
||||
'style_color' => ['nullable', 'string', Rule::in($options->styleOptions())],
|
||||
'menu_color' => ['nullable', 'string', Rule::in($options->menuOptions())],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user