title: How to check if a specific string contains in a db value and display that string on the blade in laravel
body: <p>In my laravel 9 application's DB I have a table called members. There I have a column for a summary.</p>
  <p>I need to find if any user has entered a text for the summary which includes the string, &quot;ACCURA&quot;.</p>
  <p>If there are any, then when displaying users' details in the blade, for the user's last name ACCURA string needs to be concatenated.</p>
  <p><strong>EG: if the user's last name is Adams and he has an ACCURA string in his summary text value, his last name should display as</strong></p>
  <p>Adams ACCURA</p>
  <p>if not it should be just Adams</p>
  <p>Following is my controller's index function</p>
  <pre><code>public function index(Request $request)
      {
          $findString = 'ACCURA';
          $accuraString = Member::where('summary', 'like', '%' . $findString . '%')-&gt;get();
          ;
          if ($request-&gt;filled('search')) {
              $members = Member::search($request-&gt;search)-&gt;get(); // search by value
          } else {
              $members = Member::orderBy('id','asc')-&gt;paginate('5'); // list 10 rows
          }
  
          return view('members', compact('members','accuraString'));
      }
  </code></pre>
  <p>And following is my blade</p>
  <pre><code>@foreach ($members as $member)
                      &lt;tr&gt;
                          &lt;td&gt;{{ $member-&gt;id }}&lt;/td&gt;
                          &lt;td&gt;{{ $member-&gt;firstname }}&lt;/td&gt;
                          &lt;td&gt;{{ $member-&gt;lastname }}{{ $accuraString }}&lt;/td&gt;
                          &lt;td&gt;{{ $member-&gt;dateofbirth }}&lt;/td&gt;
                          &lt;td&gt;{{ $member-&gt;dsdivision }}&lt;/td&gt;
                          &lt;td&gt;
                              &lt;form action=&quot;{{ route('members.destroy',$member-&gt;id) }}&quot; method=&quot;Post&quot;&gt;
                                  &lt;a class=&quot;btn btn-primary&quot; href=&quot;{{ route('members.edit',$member-&gt;id) }}&quot;&gt;Edit&lt;/a&gt;
                                  @csrf
                                  @method('DELETE')
                                  &lt;input name=&quot;_method&quot; type=&quot;hidden&quot; value=&quot;DELETE&quot;&gt;
                                  &lt;button type=&quot;submit&quot; onclick=&quot;return confirm('Are you sure?')&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/button&gt;
                              &lt;/form&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                  @endforeach
  </code></pre>
  <p>Here the blade output is wrong,</p>
  <p>How can I display the ACCURA text on my blade with the last name only if the summary contains the string ACCURA</p>