Initial PHP rebuild of the app
This commit is contained in:
690 files changed
+33944
-12046
No files matched your search
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\Tenant\TenantContext;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class NotificationController extends Controller
|
||||
{
|
||||
public function index(Request $request, TenantContext $tenant): View
|
||||
{
|
||||
$business = $tenant->require();
|
||||
$notifications = $request->user()->receivedNotifications()->where('businessId', $business->id)->latest('createdAt')->with('appointment')->paginate(20);
|
||||
return view('customer.notifications', compact('business', 'notifications'));
|
||||
}
|
||||
|
||||
public function read(Request $request, TenantContext $tenant, string $notification): RedirectResponse
|
||||
{
|
||||
$tenant->require();
|
||||
$item = $request->user()->receivedNotifications()->where('businessId', $tenant->id())->findOrFail($notification);
|
||||
$item->readAt = now();
|
||||
$item->save();
|
||||
return back();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user