Code Duplication    Length = 16-17 lines in 3 locations

app/Http/Controllers/Admin/Blog/ArticleController.php 1 location

@@ 110-125 (lines=16) @@
107
     *
108
     * @return \Illuminate\Http\RedirectResponse
109
     */
110
    public function update(Request $request, int $id): RedirectResponse
111
    {
112
        ArticleValidator::update($request->all(), $id)->validate();
113
114
        $article = Article::find($id);
115
116
        if (ArticleRepository::update($request->all(), $article)) {
117
            return redirect()
118
                ->route('admin.blog.article.index')
119
                ->with('success', 'Your article has been updated successfully !');
120
        }
121
122
        return redirect()
123
            ->route('admin.blog.article.index')
124
            ->with('danger', 'An error occurred while updating your article !');
125
    }
126
127
    /**
128
     * Handle the delete request for the article.

app/Http/Controllers/Admin/Blog/CategoryController.php 1 location

@@ 103-118 (lines=16) @@
100
     *
101
     * @return \Illuminate\Http\RedirectResponse
102
     */
103
    public function update(Request $request, int $id): RedirectResponse
104
    {
105
        CategoryValidator::update($request->all(), $id)->validate();
106
107
        $category = Category::find($id);
108
109
        if (CategoryRepository::update($request->all(), $category)) {
110
            return redirect()
111
                ->route('admin.blog.category.index')
112
                ->with('success', 'Your category has been updated successfully !');
113
        }
114
115
        return redirect()
116
            ->route('admin.blog.category.index')
117
            ->with('danger', 'An error occurred while updating your category !');
118
    }
119
120
    /**
121
     * Handle the delete request for the category.

app/Http/Controllers/UserController.php 1 location

@@ 161-177 (lines=17) @@
158
     *
159
     * @return \Illuminate\Http\RedirectResponse
160
     */
161
    protected function updatePassword(Request $request): RedirectResponse
162
    {
163
        $user = Auth::user();
164
165
        if (!Hash::check($request->input('oldpassword'), $user->password)) {
166
            return redirect()
167
                ->route('users.user.settings')
168
                ->with('danger', 'Your current Password does not match !');
169
        }
170
171
        UserValidator::updatePassword($request->all())->validate();
172
        UserRepository::updatePassword($request->all(), $user);
173
174
        return redirect()
175
            ->route('users.user.settings')
176
            ->with('success', 'Your Password has been updated successfully !');
177
    }
178
}
179