/** * Remove the specified Widgets from storage. * * @param int $id * * @return Response */ public function destroy($id) { $widgets = $this->widgetsRepository->findWidgetsById($id); if (empty($widgets)) { Quarx::notification('Widgets not found', 'warning'); return redirect(route('quarx.widgets.index')); } $widgets->delete(); Quarx::notification('Widgets deleted successfully.', 'success'); return redirect(route('quarx.widgets.index')); }
/** * Get a widget. * * @param string $slug * * @return widget */ public function widget($slug) { $widget = WidgetRepository::getWidgetBySLUG($slug); if (Gate::allows('quarx', Auth::user())) { $widget->content .= '<a href="' . url('quarx/widgets/' . $widget->id . '/edit') . '" style="margin-left: 8px;" class="btn btn-xs btn-default"><span class="fa fa-pencil"></span> Edit</a>'; } return $widget->content; }