Skip to content

Instantly share code, notes, and snippets.

@arodbits
Last active February 7, 2017 21:17
Show Gist options
  • Select an option

  • Save arodbits/bc2f775d7a9e5c6a46916eb97b62d400 to your computer and use it in GitHub Desktop.

Select an option

Save arodbits/bc2f775d7a9e5c6a46916eb97b62d400 to your computer and use it in GitHub Desktop.
PlayerActivityFilter.php
<?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