add nova
This commit is contained in:
26
nova/src/Http/Controllers/NotificationDeleteController.php
Normal file
26
nova/src/Http/Controllers/NotificationDeleteController.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Nova\Http\Controllers;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
use Laravel\Nova\Http\Requests\NotificationRequest;
|
||||
use Laravel\Nova\Notifications\Notification;
|
||||
|
||||
class NotificationDeleteController extends Controller
|
||||
{
|
||||
/**
|
||||
* Mark the given notification as read.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NotificationRequest $request
|
||||
* @param int|string $notification
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function __invoke(NotificationRequest $request, $notification)
|
||||
{
|
||||
$notification = Notification::findOrFail($notification);
|
||||
$notification->update(['read_at' => now()]);
|
||||
$notification->delete();
|
||||
|
||||
return response()->json();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user