Skip to content

Instantly share code, notes, and snippets.

@fxcosta
Created May 26, 2017 01:25
Show Gist options
  • Save fxcosta/dccaeb2385134b5b1f7233fa8cc3259b to your computer and use it in GitHub Desktop.
Save fxcosta/dccaeb2385134b5b1f7233fa8cc3259b to your computer and use it in GitHub Desktop.
<?php
class Example
{
public $subject;
public function __construct()
{
$this->subject = 1;
}
public function something()
{
$collection = collect([1, 2, 3, 4]);
$filtered = $collection->filter(function ($value, $key) {
return $this->subject === $value;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment