title: Laravel - check request method
body: <p>I'm an iOS lead on an app and trying to fix some API bugs whilst our dev is 'unavailable'. I'm almost completely new to Laravel and trying to check what the request method is. I have followed some guidance from another question but have been unable to get it working:</p>
  
  <pre><code>public function defaults(Request $request, User $user){
      $follow_ids = explode(',', env('FOLLOW_DEFAULTS'));
  
      if ($request-&gt;isMethod('post')) {
          return ['user' =&gt; $user];
      }
  
      $user-&gt;follows()-&gt;syncWithoutDetaching($follow_ids);
  
      return ['user.follows' =&gt; $user-&gt;follows-&gt;toArray()];
  }
  </code></pre>
  
  <p>Do you know where I might be going wrong here? Thanks in advance.</p>
  
  <p>When the request is returned it always just seems to skip over and return <code>['user.follows' =&gt; $user-&gt;follows-&gt;toArray()]</code></p>