/**
  * @param Campaign $campaign
  * @param CampaignWidget $widget
  * @param Request $request
  * @return CampaignWidget
  * @throws \Exception
  */
 public function destroy(Campaign $campaign, CampaignWidget $widget, Request $request)
 {
     if ($campaign->widgets->contains($widget->id)) {
         if ($widget->delete()) {
             $widget->id = false;
         }
     }
     return $widget;
 }
 protected function listeners()
 {
     $this->app->booted(function () {
         CampaignWidget::saving(function ($item) {
             if ($item->sort === null) {
                 $item->sort = CampaignWidget::where('campaign_id', $item->campaign_id)->count();
             }
         });
         CampaignWidget::deleted(function ($item) {
             CampaignWidget::where('campaign_id', $item->campaign_id)->where('sort', '>', $item->sort)->update(['sort' => \DB::raw('sort - 1')]);
         });
     });
 }