- Implemented push notifications with a service worker (sw.ts) to handle caching and notifications. - Added API routes for push subscription and notification management in routes/api.php. - Created NotificationTest to validate notification service functionality and ensure correct notifications are sent based on user roles and actions. - Updated Permissions component to manage notification permissions and subscriptions. - Enhanced CategoryIndex component to highlight categories based on notifications. - Excluded service worker from TypeScript compilation in tsconfig.json. - Updated Vite configuration to include service worker in the build process.
24 lines
545 B
PHP
24 lines
545 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StorePushSubscriptionRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'endpoint' => ['required', 'url', 'max:500'],
|
|
'public_key' => ['nullable', 'string', 'max:255'],
|
|
'auth_token' => ['nullable', 'string', 'max:255'],
|
|
'content_encoding' => ['nullable', 'string', 'max:255'],
|
|
];
|
|
}
|
|
}
|