Limit-Status im Upload-Flow anzeigen (Warnbanner + Sperrzustände).
Upload-Fehlercodes auswerten und freundliche Dialoge zeigen.
This commit is contained in:
42
app/Http/Requests/Tenant/NotificationPreferencesRequest.php
Normal file
42
app/Http/Requests/Tenant/NotificationPreferencesRequest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Tenant;
|
||||
|
||||
use App\Services\Packages\TenantNotificationPreferences;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class NotificationPreferencesRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'preferences' => ['required', 'array'],
|
||||
];
|
||||
|
||||
foreach (array_keys(TenantNotificationPreferences::defaults()) as $key) {
|
||||
$rules["preferences.{$key}"] = ['required', 'boolean'];
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'preferences' => $this->input('preferences', []),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user