- 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.
37 lines
934 B
PHP
37 lines
934 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class PaginatedRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'per_page' => ['nullable', 'integer', 'in:25,50,100,999999'],
|
|
'search' => ['nullable', 'string', 'max:255'],
|
|
'sort' => ['nullable', 'string'],
|
|
'direction' => ['nullable', 'string', 'in:asc,desc'],
|
|
'highlight' => ['nullable', 'integer'],
|
|
];
|
|
}
|
|
|
|
public function validatedWithDefaults(): array
|
|
{
|
|
$validated = $this->validated();
|
|
|
|
return [
|
|
'perPage' => $validated['per_page'] ?? 25,
|
|
'search' => $validated['search'] ?? '',
|
|
'sort' => $validated['sort'] ?? 'created_at',
|
|
'direction' => $validated['direction'] ?? 'desc',
|
|
];
|
|
}
|
|
}
|