schneespur/app/Http/Controllers/Portal/PortalNotificationController.php
Michael 2c63440ed8 Revert: move code back to project root from schneespur/ subdirectory
- Reverts the schneespur/ subdirectory restructure (b8e426b)
- Restores package.json and vite.config.js (needed for npm build, were
  removed in an earlier cleanup before the restructure)
- Updates public/build/ assets with current Vite output (new content hashes)
2026-05-17 18:24:26 +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'));
}
}