- Updated paginated methods in multiple services to accept a highlight parameter for filtering results. - Modified notification URLs to include the highlight parameter for specific entity IDs. - Enhanced frontend components to display a message when filtered by notification, with an option to show all entries. - Implemented mark as read functionality in the notification bell component upon clicking a notification. - Updated multiple index pages to handle the highlight prop and display relevant messages.
43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
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();
|
|
|
|
$result = [
|
|
'perPage' => $validated['per_page'] ?? 25,
|
|
'search' => $validated['search'] ?? '',
|
|
'sort' => $validated['sort'] ?? 'created_at',
|
|
'direction' => $validated['direction'] ?? 'desc',
|
|
];
|
|
|
|
if (! empty($validated['highlight'])) {
|
|
$result['highlight'] = (int) $validated['highlight'];
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
}
|