Guest User

Untitled

a guest
Jun 13th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. $friends = collect([
  4. ['first_name' => 'Rachel', 'last_name' => 'Green'],
  5. ['first_name' => 'Monica', 'last_name' => 'Geller'],
  6. ['first_name' => 'Phoebe', 'last_name' => 'Buffay'],
  7. ['first_name' => 'Joey', 'last_name' => 'Tribbiani'],
  8. ['first_name' => 'Chandler', 'last_name' => 'Bing'],
  9. ['first_name' => 'Ross', 'last_name' => 'Geller'],
  10. ]);
  11.  
  12.  
  13.  
  14. $filtered = $friends->whereNotIn('last_name', 'Geller');
  15.  
  16. $filtered->all();
  17.  
  18. /*
  19. [
  20. 0 => [
  21. "first_name" => "Rachel",
  22. "last_name" => "Green",
  23. ],
  24. 2 => [
  25. "first_name" => "Phoebe",
  26. "last_name" => "Buffay",
  27. ],
  28. 3 => [
  29. "first_name" => "Joey",
  30. "last_name" => "Tribbiani",
  31. ],
  32. 4 => [
  33. "first_name" => "Chandler",
  34. "last_name" => "Bing",
  35. ],
  36. ]
  37.  
  38. */
Add Comment
Please, Sign In to add comment