<NME> UserController.php
<BEF> <?php

namespace App\Http\Controllers\Api;

use App\Scopes\StatusScope;
use App\User;
use Illuminate\Support\Str;
use Image;
use Illuminate\Http\Request;

class UserController extends ApiController
{
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Display a listing of the resource.
     *
     *
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @throws \Exception
     */
    public function index(Request $request)
    {
        $users = User::withoutGlobalScope(StatusScope::class)
            ->filter($request->all())
            ->orderBy('created_at', 'desc')
            ->paginate(10);

        return $this->response->collection($users);
    }

    /**
     * Update User Status By User ID.
     *
     * @param $id
     * @param Request $request
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function status(Request $request, $id)
    {
        $input = $request->all();
        $user = User::withoutGlobalScope(StatusScope::class)->findOrFail($id);
        if (auth()->user()->id == $id || $user->is_admin) {
            return $this->response->withUnauthorized('You can\'t change status for yourself and other Administrators!');
        }

        $user->update($input);

        return $this->response->withNoContent();
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param \App\Http\Requests\UserRequest $request
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function store(UserRequest $request)
    {
        $data = array_merge($request->all(), [
            'password' => bcrypt($request->get('password')),
            'confirm_code' => Str::random(64),
        ]);

        \DB::transaction(function () use ($request, $data) {
            $user = User::create($data);

            $user->syncRoles($request->get('roles'));
        });

        return $this->response->withNoContent();
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param int $id
     *
     * @return \Illuminate\Http\JsonResponse
     * @throws \Exception
     */
    public function edit($id)
    {
        $user = User::withoutGlobalScopes()->findOrFail($id);

        return $this->response->item($user);
    }

    /**
     * Update the specified resource in storage.
     *
     * @param \Illuminate\Http\Request $request
     * @param int                      $id
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function update(Request $request, $id)
    {
        $user = User::findOrFail($id);

        \DB::transaction(function () use ($request, $user) {
            $user->update($request->all());

            $user->syncRoles($request->get('roles'));
        });

        return $this->response->withNoContent();
    }

    /**
     * Crop Avatar.
     *
     * @param Request $request
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function cropAvatar(Request $request)
    {
        $currentImage = $request->get('image');
        $data = $request->get('data');

        $image = Image::make($currentImage['relative_url']);

        $image->crop((int) $data['width'], (int) $data['height'], (int) $data['x'], (int) $data['y']);

        $image->save($currentImage['relative_url']);

        auth()->user()->update(['avatar' => $currentImage['url']]);

        return $this->response->json($currentImage);
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param int $id
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function destroy($id)
    {
        $user = User::findOrFail($id);
        if (auth()->user()->id == $id || $user->is_admin) {
            return $this->response->withUnauthorized('You can\'t delete for yourself and other Administrators!');
        }

        $user->destroy($id);

        return $this->response->withNoContent();
    }
}

<MSG> Remove construct method

<DFF> @@ -10,11 +10,6 @@ use App\Http\Requests\UserRequest;
 
 class UserController extends ApiController
 {
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
     /**
      * Display a listing of the resource.
      *

{'commit': 'diff --git a/app/Http/Controllers/Api/ArticleController.php b/app/Http/Controllers/Api/ArticleController.php\nindex 19cb825..3d214d5 100644\n--- a/app/Http/Controllers/Api/ArticleController.php\n+++ b/app/Http/Controllers/Api/ArticleController.php\n@@ -9,11 +9,6 @@ use App\\Http\\Requests\\ArticleRequest;\n \n class ArticleController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Display a listing of the resource.\n      *\ndiff --git a/app/Http/Controllers/Api/CategoryController.php b/app/Http/Controllers/Api/CategoryController.php\nindex aa3035b..5d07b7f 100644\n--- a/app/Http/Controllers/Api/CategoryController.php\n+++ b/app/Http/Controllers/Api/CategoryController.php\n@@ -8,11 +8,6 @@ use App\\Http\\Requests\\CategoryRequest;\n \n class CategoryController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Display a listing of the resource.\n      *\ndiff --git a/app/Http/Controllers/Api/CommentController.php b/app/Http/Controllers/Api/CommentController.php\nindex 7f0027f..b436bb4 100644\n--- a/app/Http/Controllers/Api/CommentController.php\n+++ b/app/Http/Controllers/Api/CommentController.php\n@@ -12,11 +12,6 @@ use App\\Comment;\n \n class CommentController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Display a listing of the resource.\n      *\ndiff --git a/app/Http/Controllers/Api/DiscussionController.php b/app/Http/Controllers/Api/DiscussionController.php\nindex 0427c3a..01f0380 100644\n--- a/app/Http/Controllers/Api/DiscussionController.php\n+++ b/app/Http/Controllers/Api/DiscussionController.php\n@@ -8,11 +8,6 @@ use App\\Http\\Requests\\DiscussionRequest;\n \n class DiscussionController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Display a listing of the resource.\n      *\ndiff --git a/app/Http/Controllers/Api/HomeController.php b/app/Http/Controllers/Api/HomeController.php\nindex 38b43ea..9022370 100644\n--- a/app/Http/Controllers/Api/HomeController.php\n+++ b/app/Http/Controllers/Api/HomeController.php\n@@ -9,11 +9,6 @@ use App\\Visitor;\n \n class HomeController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     public function statistics()\n     {\n         $users = User::query()->count();\ndiff --git a/app/Http/Controllers/Api/LinkController.php b/app/Http/Controllers/Api/LinkController.php\nindex 15d942c..e0d3b60 100644\n--- a/app/Http/Controllers/Api/LinkController.php\n+++ b/app/Http/Controllers/Api/LinkController.php\n@@ -9,11 +9,6 @@ use App\\Http\\Requests\\LinkRequest;\n \n class LinkController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Display a listing of the resource.\n      *\ndiff --git a/app/Http/Controllers/Api/MeController.php b/app/Http/Controllers/Api/MeController.php\nindex 4f2df44..824f618 100644\n--- a/app/Http/Controllers/Api/MeController.php\n+++ b/app/Http/Controllers/Api/MeController.php\n@@ -8,11 +8,6 @@ use Illuminate\\Http\\Request;\n \n class MeController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * post up vote the comment by user.\n      *\ndiff --git a/app/Http/Controllers/Api/RoleController.php b/app/Http/Controllers/Api/RoleController.php\nindex 5bd0eec..fc9e382 100644\n--- a/app/Http/Controllers/Api/RoleController.php\n+++ b/app/Http/Controllers/Api/RoleController.php\n@@ -7,11 +7,6 @@ use Spatie\\Permission\\Models\\Role;\n \n class RoleController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Display a listing of the resource.\n      *\ndiff --git a/app/Http/Controllers/Api/SystemController.php b/app/Http/Controllers/Api/SystemController.php\nindex 00e5987..1565efa 100644\n--- a/app/Http/Controllers/Api/SystemController.php\n+++ b/app/Http/Controllers/Api/SystemController.php\n@@ -4,17 +4,9 @@ namespace App\\Http\\Controllers\\Api;\n \n class SystemController extends ApiController\n {\n-    /**\n-     * SystemController constructor.\n-     */\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Get the system info.\n-     * \n+     *\n      * @return mixed\n      */\n     public function getSystemInfo()\ndiff --git a/app/Http/Controllers/Api/TagController.php b/app/Http/Controllers/Api/TagController.php\nindex 685857a..f0e64ad 100644\n--- a/app/Http/Controllers/Api/TagController.php\n+++ b/app/Http/Controllers/Api/TagController.php\n@@ -8,11 +8,6 @@ use App\\Http\\Requests\\TagRequest;\n \n class TagController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Display a listing of the resource.\n      *\ndiff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php\nindex 3dc79a3..2455004 100644\n--- a/app/Http/Controllers/Api/UserController.php\n+++ b/app/Http/Controllers/Api/UserController.php\n@@ -10,11 +10,6 @@ use App\\Http\\Requests\\UserRequest;\n \n class UserController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Display a listing of the resource.\n      *\n', 'commit_subject': 'Remove construct method', 'repo_name': 'jcc/blog', 'committer': {'name': 'jcc', 'email': '55469bba5d1c7a68acf38b743489eab79b88a067@gmail.com', 'time_sec': '1529826408', 'tz_offset': '480', 'date': {'seconds': '1529826408'}}, 'commit_tree': '536fb513289037e071b3312f728fa1587c118f1a', 'commit_message': 'Remove construct method\n', 'language_name': 'JavaScript', 'license': 'mit', 'hunks': '@@ -10,11 +10,6 @@ use App\\Http\\Requests\\UserRequest;\n \n class UserController extends ApiController\n {\n-    public function __construct()\n-    {\n-        parent::__construct();\n-    }\n-\n     /**\n      * Display a listing of the resource.\n      *\n', 'addition_count': 0, 'deletion_count': 5, 'src_file': 'a/app/Http/Controllers/Api/UserController.php', 'tgt_file': 'b/app/Http/Controllers/Api/UserController.php', 'file_extension': '.php', 'before_file': "<?php\n\nnamespace App\\Http\\Controllers\\Api;\n\nuse App\\Scopes\\StatusScope;\nuse App\\User;\nuse Illuminate\\Support\\Str;\nuse Image;\nuse Illuminate\\Http\\Request;\n\nclass UserController extends ApiController\n{\n    public function __construct()\n    {\n        parent::__construct();\n    }\n\n    /**\n     * Display a listing of the resource.\n     *\n     *\n     * @param Request $request\n     * @return \\Illuminate\\Http\\JsonResponse\n     * @throws \\Exception\n     */\n    public function index(Request $request)\n    {\n        $users = User::withoutGlobalScope(StatusScope::class)\n            ->filter($request->all())\n            ->orderBy('created_at', 'desc')\n            ->paginate(10);\n\n        return $this->response->collection($users);\n    }\n\n    /**\n     * Update User Status By User ID.\n     *\n     * @param $id\n     * @param Request $request\n     *\n     * @return \\Illuminate\\Http\\JsonResponse\n     */\n    public function status(Request $request, $id)\n    {\n        $input = $request->all();\n        $user = User::withoutGlobalScope(StatusScope::class)->findOrFail($id);\n        if (auth()->user()->id == $id || $user->is_admin) {\n            return $this->response->withUnauthorized('You can\\'t change status for yourself and other Administrators!');\n        }\n\n        $user->update($input);\n\n        return $this->response->withNoContent();\n    }\n\n    /**\n     * Store a newly created resource in storage.\n     *\n     * @param \\App\\Http\\Requests\\UserRequest $request\n     *\n     * @return \\Illuminate\\Http\\JsonResponse\n     */\n    public function store(UserRequest $request)\n    {\n        $data = array_merge($request->all(), [\n            'password' => bcrypt($request->get('password')),\n            'confirm_code' => Str::random(64),\n        ]);\n\n        \\DB::transaction(function () use ($request, $data) {\n            $user = User::create($data);\n\n            $user->syncRoles($request->get('roles'));\n        });\n\n        return $this->response->withNoContent();\n    }\n\n    /**\n     * Show the form for editing the specified resource.\n     *\n     * @param int $id\n     *\n     * @return \\Illuminate\\Http\\JsonResponse\n     * @throws \\Exception\n     */\n    public function edit($id)\n    {\n        $user = User::withoutGlobalScopes()->findOrFail($id);\n\n        return $this->response->item($user);\n    }\n\n    /**\n     * Update the specified resource in storage.\n     *\n     * @param \\Illuminate\\Http\\Request $request\n     * @param int                      $id\n     *\n     * @return \\Illuminate\\Http\\JsonResponse\n     */\n    public function update(Request $request, $id)\n    {\n        $user = User::findOrFail($id);\n\n        \\DB::transaction(function () use ($request, $user) {\n            $user->update($request->all());\n\n            $user->syncRoles($request->get('roles'));\n        });\n\n        return $this->response->withNoContent();\n    }\n\n    /**\n     * Crop Avatar.\n     *\n     * @param Request $request\n     *\n     * @return \\Illuminate\\Http\\JsonResponse\n     */\n    public function cropAvatar(Request $request)\n    {\n        $currentImage = $request->get('image');\n        $data = $request->get('data');\n\n        $image = Image::make($currentImage['relative_url']);\n\n        $image->crop((int) $data['width'], (int) $data['height'], (int) $data['x'], (int) $data['y']);\n\n        $image->save($currentImage['relative_url']);\n\n        auth()->user()->update(['avatar' => $currentImage['url']]);\n\n        return $this->response->json($currentImage);\n    }\n\n    /**\n     * Remove the specified resource from storage.\n     *\n     * @param int $id\n     *\n     * @return \\Illuminate\\Http\\JsonResponse\n     */\n    public function destroy($id)\n    {\n        $user = User::findOrFail($id);\n        if (auth()->user()->id == $id || $user->is_admin) {\n            return $this->response->withUnauthorized('You can\\'t delete for yourself and other Administrators!');\n        }\n\n        $user->destroy($id);\n\n        return $this->response->withNoContent();\n    }\n}\n", 'message': 'Remove construct method\n', 'author_name': 'jcc', 'lang': 'php'}