public function delete($id)
 {
     $notifications = new Notifications();
     $notification = $notifications->getById($id);
     if ($notification) {
         if ($notification->user_id === Auth::getUserId()) {
             $notification->delete();
         }
     }
     return \Redirect::to('notifications');
 }
 /**
  * Save new notification
  *
  * @param NewNotification $notification
  *
  * @return bool
  */
 public function addNewNotification(\Flocc\Notifications\NewNotification $notification)
 {
     if ($this->isExistsCheckByUniqueKey($notification->getUniqueKey(), $notification->getUserId()) === false) {
         $new = new Notifications();
         $new->user_id = $notification->getUserId();
         $new->sent_time = \DB::raw('current_timestamp');
         $new->unique_key = $notification->getUniqueKey();
         $new->type_id = $notification->getTypeId();
         $new->callback = $notification->getCallback();
         $info = $new->save() == 0 ? false : true;
         $id = (int) \DB::getPdo()->lastInsertId();
         /**
          * Save variables
          */
         if ($info === true) {
             foreach ($notification->getVariables() as $name => $value) {
                 $variable = new Variables();
                 $variable->notification_id = $id;
                 $variable->name = $name;
                 $variable->value = $value;
                 $variable->save();
             }
         }
         return $info;
     }
     return false;
 }