public static getWidgetBySLUG ( integer $slug ) : |
||
$slug | integer | |
return |
public static function getWidgetBySLUG($slug)
{
return Widget::where('slug', $slug)->first();
}
/** * 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; }