31 lines
1.0 KiB
PHP
31 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Notifications;
|
|
|
|
use App\Http\Requests\ApiFormRequest;
|
|
|
|
class NotificationUpdateRequest extends ApiFormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user() !== null;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'title' => ['sometimes', 'required', 'string', 'max:150'],
|
|
'message' => ['sometimes', 'required', 'string', 'max:5000'],
|
|
'target_group' => ['sometimes', 'required', 'string', 'max:50'],
|
|
'channels' => ['sometimes', 'required', 'array'],
|
|
'channels.*' => ['string', 'in:in_app,email,sms'],
|
|
'priority' => ['nullable', 'string', 'max:20'],
|
|
'status' => ['nullable', 'string', 'max:20'],
|
|
'action_url' => ['nullable', 'string', 'max:255'],
|
|
'attachment_path' => ['nullable', 'string', 'max:255'],
|
|
'scheduled_at' => ['nullable', 'date'],
|
|
'expires_at' => ['nullable', 'date', 'after_or_equal:scheduled_at'],
|
|
];
|
|
}
|
|
}
|