Last active
February 7, 2017 21:17
-
-
Save arodbits/bc2f775d7a9e5c6a46916eb97b62d400 to your computer and use it in GitHub Desktop.
PlayerActivityFilter.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function apply($filters = []){ | |
| //if any filter is passed | |
| foreach ($filters as $filter) { | |
| if (method_exists($this, $filter)) { | |
| call_user_func([$this, $filter]); | |
| } else { | |
| throw new ActivityBadFilterException($filter); | |
| } | |
| } | |
| //default behaviour | |
| if ($this->generatedByQueries->isEmpty()) { | |
| $this->everyone(); | |
| } | |
| if ($this->typeQueries->isEmpty()) { | |
| $this->allActivities(); | |
| } | |
| //generate the final query builder | |
| $this->processFilters(); | |
| // dd($this->query_builder->toSql(), $this->query_builder->getBindings()); | |
| return $this; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment