title: How to search with full name using like in Laravel
body: <p>Currently there is first_name, middle_name and last_name in separate fields I can search using above names but now I want to search with full name:</p>
  <p>My Code:</p>
  <pre><code>    $attorneyName=$address=$firmName=&quot;&quot;;
      if ($request-&gt;has('attorneyName')) {
          $attorneyName = $request-&gt;attorneyName;
      }
      if ($request-&gt;has('address')) {
          $address = $request-&gt;address;
      }
  
      try {
          $attorneyResultQuery = Attorney::query();
          if (!empty($attorneyName)) {
              $attorneyResultQuery-&gt;where('first_name', 'like', '%' . $attorneyName . '%');
              $attorneyResultQuery-&gt;orWhere('middle_name', 'like', '%' . $attorneyName . '%');
              $attorneyResultQuery-&gt;orWhere('last_name', 'like', '%' . $attorneyName . '%');
              $attorneyResultQuery-&gt;orWhereRaw(&quot;concat(first_name, ' ',middle_name, ' ',last_name) like '%?%'&quot;,$attorneyName); // searching with full name
          }
          if (!empty($address)) {
              $attorneyResultQuery-&gt;where('street_address', 'like', '%' . $address . '%');
          }
          $searchData=$attorneyResultQuery-&gt;get();
  
          return response(['status' =&gt; true, 'message' =&gt; 'Searched Data', 'data' =&gt; $searchData], 200);
      }catch (\Exception $ex) {
          return response(['status' =&gt; false, 'message' =&gt; 'Validation Errors', 'errors' =&gt; $ex-&gt;getMessage()], 500);
      }
  </code></pre>
  <p>as you can see I am doing like this</p>
  <pre><code> $attorneyResultQuery-&gt;orWhere(&quot;concat(first_name, ' ',middle_name, ' ',last_name) like '%?%'&quot;,$attorneyName);
  </code></pre>
  <p>This is my body request</p>
  <pre><code>  {
  &quot;attorneyName&quot;: &quot;Bilal nadeem hy&quot;,
    }
  </code></pre>
  <p>I am searching with first_name (Bilal) middle_name (nadeem) and last_name (hy) but it's showing my all other records as well if I search with full name. How can I solve this issue?</p>