title: Laravel delete model custom return
body: <p>Okay so I'm trying to delete a model and then return a <code>response()-&gt;json([...])</code>. For some reason when I delete the model it always returns <code>NULL</code> whatever I do.</p>
  
  <p>Here is the function in the <code>User</code> model that is used to delete the given user.</p>
  
  <pre><code>/**
   * @return bool|\Illuminate\Http\JsonResponse|null
   * Delete user
   */
  public function deleteUser()
  {
  
      // If the admin deletes his own account we need to check if there is another admin. There must exists at least 1 admin
      if ($this-&gt;user_id == auth()-&gt;user()-&gt;user_id &amp;&amp; (auth()-&gt;user-&gt;hasRole('admin'))) {
          if (User::whereHas('roles', function($query) { $query-&gt;where('id', 1); })-&gt;count() &lt;= 1) {
              return response()-&gt;json([
                  'success' =&gt; false,
                  'message' =&gt; 'There must be another admin if you remove your own user.'
              ]);
          }
      }
  
     if (!$this-&gt;delete()) {
         return response()-&gt;json([
            'success' =&gt; false,
            'message' =&gt; 'Could not delete user!'
         ]);
     }
  
      return response()-&gt;json([
          'success' =&gt; true,
          'message' =&gt; 'User was deleted successfully!'
      ]);
  </code></pre>
  
  <p>Is there something I'm missing when I want to return a custom response?</p>
  
  <p><strong><em>EDIT</em></strong>
  Here is the controller method</p>
  
  <pre><code>public function postDelete(User $user)
  {
      $user-&gt;deleteUser();
  }
  </code></pre>