Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel onclick all notification reads

class UserNotificationsController extends Controller
{

/**
     * @param  int  $id  Notification ID
     * @return IlluminateHttpResponse
     */
    public function show($id)
    {
        $notification = auth()->user()->notifications()->where('id', $id)->first();

        if ($notification) {
            $notification->markAsRead();
            return redirect($notification->data['link']);
        }
    }
}
Source by laracasts.com #
 
PREVIOUS NEXT
Tagged: #laravel #onclick #notification #reads
ADD COMMENT
Topic
Name
6+2 =