/** * Apply a single scope on the given builder instance. * * @param \Illuminate\Database\Eloquent\Scope|\Closure $scope * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function applyScope($scope, $builder) { if ($scope instanceof Closure) { $scope($builder); } elseif ($scope instanceof Scope) { $scope->apply($builder, $this->getModel()); } }