/**
  * @param Widget $widget
  *
  * @return bool
  */
 public function delete(Widget $widget)
 {
     if (!$this->widget->isExists()) {
         return false;
     }
     WidgetModel::findOrFail($this->widget->getId())->delete();
     return true;
 }
 public function setTemplate()
 {
     $widgetId = (int) $this->getRequiredParameter('widget_id');
     $template = $this->getParameter('template');
     $widget = Widget::findOrFail($widgetId);
     $widget->update(['template' => $template]);
     $this->setMessage(trans('widgets::core.messages.template_updated', ['template' => $template]));
     $this->setContent(true);
 }