title: Laravel 5.8: How to check data type in Controller
body: <p>I have a Controller with a method like this</p>
  <pre><code>public function chargeWallet(Request $request, $wallet, $user)
      {
          try {
              $data = $request-&gt;validate([
                 'charge' =&gt; 'required|integer',
              ]);
          }catch (\Exception $e) {
              dd($e);
          }
          return redirect(back());
      }
  </code></pre>
  <p>As you can see I'm checking that the <code>charge</code> type must be <strong>integer</strong>.</p>
  <p>Now I want to check if the data type of <code>charge</code> was integer, then do this:</p>
  <pre><code>if($data['charge'] == INTEGER)
     flash()-&gt;overlay('Success!', 'Success Message', 'success');
  </code></pre>
  <p>So the question is, how to check the type of data in the Controller ? What should I write instead of <code>INTEGER</code> for checking <code>$data['charge']</code> ?</p>