You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monitor-doc/app/Http/Controllers/NotificationController.php

22 lines
624 B
PHTML

<?php
namespace App\Http\Controllers;
use App\Models\Document;
use App\Models\Notification;
use Illuminate\Http\Request;
class NotificationController extends Controller
{
public function redirect(Notification $notification)
{
// todo: here you will receive notification id -> redirect to page with related page with status read
$notification->update(['status' => Notification::STATUS_READ]);
if ($notification->model_related == Document::class) {
return redirect()->route('docs.show', $notification->model_id);
}
return redirect()->route('dashboard');
}
}