schneespur/release/schneespur-1.0.2/app/Http/Controllers/Portal/PortalNotificationController.php
Michael 7288b93500 Release v1.0.2: diagnostic infrastructure core
Add neutral diagnostic framework for future reporting modules:
- DiagnosticReporterInterface, Registry, Manager, PayloadSanitizer
- Laravel exception hook in bootstrap/app.php
- Module permission declarations (requires_permissions in module.json)
- Core diagnostic report points (module boot/install/update failures)
- Module documentation update (moduldoku.md)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-18 16:54:11 +00:00

33 lines
1 KiB
PHP

<?php
namespace App\Http\Controllers\Portal;
use App\Http\Controllers\Controller;
use App\Models\Customer;
use App\Models\Job;
use App\Models\NotificationLog;
use Illuminate\View\View;
class PortalNotificationController extends Controller
{
public function index(): View
{
/** @var Customer $customer */
$customer = auth('customer')->user();
$logs = NotificationLog::query()
->where(function ($query) use ($customer) {
$query->where(function ($q) use ($customer) {
$q->where('notifiable_type', Job::class)
->whereIn('notifiable_id', $customer->serviceJobs()->select('id'));
})->orWhere(function ($q) use ($customer) {
$q->where('notifiable_type', Customer::class)
->where('notifiable_id', $customer->id);
});
})
->orderByDesc('created_at')
->paginate(20);
return view('portal.notifications.index', compact('logs'));
}
}