public function boot()
 {
     if (function_exists('config_path')) {
         $this->publishes([__DIR__ . '/../../config/phonecom.php' => config_path('phonecom.php')]);
     }
     Model::setClient($this->app['phonecom']);
 }
 public function remove(Builder $builder, Model $model)
 {
     $column = $model->getQualifiedSingleServiceTypeColumn();
     $query = $builder->getQuery();
     $bindings = $query->getRawBindings()['where'];
     foreach ((array) $query->wheres as $key => $where) {
         if ($this->isSingleServiceInheritanceConstraint($where, $column)) {
             unset($query->wheres[$key]);
             foreach ($where['values'] as $value) {
                 if (($binding_key = array_search($value, $bindings)) >= 0) {
                     unset($bindings[$binding_key]);
                 }
             }
             $query->setBindings(array_values($bindings));
             $query->wheres = array_values($query->wheres);
         }
     }
 }
예제 #3
0
 public function getWithTotal()
 {
     list($items, $total) = $this->query->getWithTotal();
     return [$this->model->hydrate($items), $total];
 }
예제 #4
0
 public function setModel(Model $model)
 {
     $this->model = $model;
     $this->query->from($model->getPathInfo(), $model->getPathParams());
     return $this;
 }