Code Duplication    Length = 15-16 lines in 2 locations

src/Http/Controllers/WidgetsController.php 2 locations

@@ 70-85 (lines=16) @@
67
     * @param \Yajra\CMS\Http\Requests\WidgetFormRequest $request
68
     * @return \Illuminate\Http\RedirectResponse
69
     */
70
    public function store(WidgetFormRequest $request)
71
    {
72
        $widget = new Widget;
73
        $widget->fill($request->all());
74
        $widget->published     = $request->get('published', false);
75
        $widget->authenticated = $request->get('authenticated', false);
76
        $widget->show_title    = $request->get('show_title', false);
77
        $widget->save();
78
79
        $widget->syncPermissions($request->get('permissions', []));
80
        $widget->syncMenuAssignment($request->get('menu', []), $request->get('assignment', Widget::ALL_PAGES));
81
82
        flash()->success(trans('cms::widget.store.success'));
83
84
        return redirect()->route('administrator.widgets.index');
85
    }
86
87
    /**
88
     * Show and edit selected widget.
@@ 108-122 (lines=15) @@
105
     * @param \Yajra\CMS\Http\Requests\WidgetFormRequest $request
106
     * @return \Illuminate\Http\RedirectResponse
107
     */
108
    public function update(Widget $widget, WidgetFormRequest $request)
109
    {
110
        $widget->fill($request->all());
111
        $widget->published     = $request->get('published', false);
112
        $widget->authenticated = $request->get('authenticated', false);
113
        $widget->show_title    = $request->get('show_title', false);
114
        $widget->save();
115
116
        $widget->syncPermissions($request->get('permissions', []));
117
        $widget->syncMenuAssignment($request->get('menu', []), $request->get('assignment', Widget::ALL_PAGES));
118
119
        flash()->success(trans('cms::widget.update.success'));
120
121
        return redirect()->route('administrator.widgets.index');
122
    }
123
124
    /**
125
     * Remove selected widget.