mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 18:59:09 -04:00
28 lines
601 B
PHP
28 lines
601 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Notifications\DatabaseNotification;
|
|
|
|
class NotificationController extends Controller
|
|
{
|
|
public function markAsRead($id)
|
|
{
|
|
$n = DatabaseNotification::find($id);
|
|
$n->read_at = date('Y-m-d h:i:s');
|
|
$n->save();
|
|
}
|
|
|
|
public function markAllAsRead()
|
|
{
|
|
$notifications = \Auth::user()->unreadNotifications;
|
|
foreach ($notifications as $n)
|
|
{
|
|
$n->read_at = date('Y-m-d h:i:s');
|
|
$n->save();
|
|
}
|
|
return $notifications;
|
|
}
|
|
}
|