public function notificationLog() { $objNotification = Notification::getInstance(); $userId = Session::get('ig_user')['id']; $where = array('rawQuery' => 'user_id=?', 'bindParams' => [$userId]); $notifications = $objNotification->getAllNotificationsWhere($where); Session::forget('ig_user.notification'); Session::forget('ig_user.count'); // print_r(Session::all());die; return view('User::notification.shownotifications', ['notifications' => $notifications]); $count = 0; foreach ($notifications as $ntf) { $data = $ntf->notifications_txt; Session::put('ig_user.notification', $data); $count++; print_r(Session::get('ig_user')['notification']); } Session::put('ig_user.count', $count); // echo "<pre>";print_r(Session::all());die; // die; // print_r($notifications); // die; }
public function getNotificationById($id) { $result = Notification::whereId($id)->first(); //first() function in sql returns the first value of the selected column return $result; }