Laravel lumen : Post API method Question is quite simple, I am using dingo package, Currently below is my code for an API call.

public function publishApplicant(Request $request,$id){
    $changeStatus = \App\User::where('id', $id)-&gt;update(array('admin_published' =&gt; 1));

    if($changeStatus){
        return response()-&gt;json([
            'message' =&gt; 'Applicant published.',
            'code' =&gt; 200,
            'status' =&gt; 1
        ], 200);
    }

    return response()-&gt;json([
        'message' =&gt; 'Applicant published.',
        'code' =&gt; 500,
        'status' =&gt; 0
    ], 200);
}


What can be improved in the above code?
You could store the response in a variable and only call return once. That seems cleaner. Also, put constants like messages and HTTP codes into constant variables.