mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-05-02 00:10:02 -05:00
(Fix) Notifications System 🐛
This commit is contained in:
@@ -149,6 +149,38 @@ class NotificationController extends Controller
|
||||
->withSuccess('Notification Marked As Read!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set A Notification To Read.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$request->user()->unreadNotifications()->findOrFail($id)->markAsRead();
|
||||
|
||||
return redirect()->route('notifications.index')
|
||||
->withSuccess('Notification Marked As Read!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Mass Update All Notification's To Read.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function updateAll(Request $request)
|
||||
{
|
||||
$current = new Carbon();
|
||||
$request->user()->unreadNotifications()->update(['read_at' => $current]);
|
||||
|
||||
return redirect()->route('notifications.index')
|
||||
->withSuccess('All Notifications Marked As Read!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete A Notification.
|
||||
*
|
||||
@@ -179,36 +211,4 @@ class NotificationController extends Controller
|
||||
return redirect()->route('notifications.index')
|
||||
->withSuccess('All Notifications Deleted!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set A Notification To Read.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function read(Request $request, $id)
|
||||
{
|
||||
$request->user()->unreadNotifications()->findOrFail($id)->markAsRead();
|
||||
|
||||
return redirect()->route('notifications.index')
|
||||
->withSuccess('Notification Marked As Read!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Mass Update All Notification's To Read.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function readAll(Request $request)
|
||||
{
|
||||
$current = new Carbon();
|
||||
$request->user()->unreadNotifications()->update(['read_at' => $current]);
|
||||
|
||||
return redirect()->route('notifications.index')
|
||||
->withSuccess('All Notifications Marked As Read!');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user