title: I want to filter out comments with specific words that are found in an array
body: <p>I am trying to filter out comments that have specific words in them. I am displaying random positive comments. I don't want them to contain words like too, small, please, next. And where the comments are a minimum of 3 words.</p>
  
  <p>Each notes and commentsRating is a database field</p>
  
  <p>I have the code that grabs me a random comment from the $commentsGood array. I want to make sure they don't contain those words mentioned above. Also if someone knows how to stream line the current array I have, would love to learn something new thanks. </p>
  
  <p>EDIT to show were the data is grabbed and what it returns. </p>
  
  <pre><code>$commentsRatings = Rating::all();
  
                  $commentsGood = collect([
                  $comments1 = $commentsRatings-&gt;where('commentsRating_1', '=', 5)-&gt;where('notes_1', '!=', '')-&gt;pluck('notes_1', 'feedback_user_id')-&gt;all(),
                  $comments2 = $commentsRatings-&gt;where('commentsRating_2', '=', 5)-&gt;where('notes_1', '!=', '')-&gt;pluck('notes_2', 'feedback_user_id')-&gt;all(),
                  $comments3 = $commentsRatings-&gt;where('commentsRating_3', '=', 5)-&gt;where('notes_1', '!=', '')-&gt;pluck('notes_3', 'feedback_user_id')-&gt;all(),
                  $comments3 = $commentsRatings-&gt;where('commentsRating_4', '=', 5)-&gt;where('notes_1', '!=', '')-&gt;pluck('notes_4', 'feedback_user_id')-&gt;all(),
                  $comments5 = $commentsRatings-&gt;where('commentsRating_5', '=', 5)-&gt;where('notes_1', '!=', '')-&gt;pluck('notes_5', 'feedback_user_id')-&gt;all(),
                  $comments6 = $commentsRatings-&gt;where('commentsRating_6', '=', 5)-&gt;where('notes_1', '!=', '')-&gt;pluck('notes_6', 'feedback_user_id')-&gt;all(),
                  $comments7 = $commentsRatings-&gt;where('commentsRating_7', '=', 5)-&gt;where('notes_1', '!=', '')-&gt;pluck('notes_7', 'feedback_user_id')-&gt;all(),
                  $comments8 = $commentsRatings-&gt;where('commentsRating_8', '=', 5)-&gt;where('notes_1', '!=', '')-&gt;pluck('notes_8', 'feedback_user_id')-&gt;all()
                ]);
  
  dd($commentsGood);
  </code></pre>
  
  <p>returns </p>
  
  <pre><code>Collection {#332 ▼
     #items: array:8 [▼
  0 =&gt; array:279 [▶]
  1 =&gt; array:205 [▶]
  2 =&gt; array:194 [▶]
  3 =&gt; array:115 [▶]
  4 =&gt; array:46 [▶]
  5 =&gt; array:29 [▶]
  6 =&gt; array:13 [▶]
  7 =&gt; array:4 [▼
    0 =&gt; "Can you please provide some answers"
    1 =&gt; "Perfect!"
    2 =&gt; "This is just too much to read"
    3 =&gt; "a little tight in the shoulders  "
  ]]}
  </code></pre>
  
  <p>Out of this array of arrays I want to remove any full comments that include the words like the ones mentioned above. </p>
  
  <p>I then run shuffle->take(1)->first to get something like. to only get one of the arrays to then get a random line from there. 
  the array returns sentences not single words, for example</p>
  
  <pre><code>array:29 [▼
    0 =&gt; "I typically would not have worn something like this but just 
    loved it. "
    1 =&gt; "please take this comment"
    2 =&gt; "Cool jeans, but one size too large."
  </code></pre>