Inheritance: extends Illuminate\Database\Eloquent\Builder
Ejemplo n.º 1
0
 /**
  * Overriding newQuery() to the custom PostBuilder with some interesting methods
  *
  * @param bool $excludeDeleted
  * @return Corcel\PostBuilder
  */
 public function newQuery($excludeDeleted = true)
 {
     $builder = new PostBuilder($this->newBaseQueryBuilder());
     $builder->setModel($this)->with($this->with);
     $builder->orderBy('post_date', 'desc');
     if (isset($this->postType) and $this->postType) {
         $builder->type($this->postType);
     }
     if ($excludeDeleted and $this->softDelete) {
         $builder->whereNull($this->getQualifiedDeletedAtColumn());
     }
     return $builder;
 }
Ejemplo n.º 2
0
 /**
  * Overriding newQuery() to the custom PostBuilder with some interesting methods.
  *
  * @param bool $excludeDeleted
  *
  * @return Corcel\PostBuilder
  */
 public function newQuery($excludeDeleted = true)
 {
     $builder = new PostBuilder($this->newBaseQueryBuilder());
     $builder->setModel($this)->with($this->with);
     // disabled the default orderBy because else Post::all()->orderBy(..)
     // is not working properly anymore.
     // $builder->orderBy('post_date', 'desc');
     if (isset($this->postType) and $this->postType) {
         $builder->type($this->postType);
     }
     if ($excludeDeleted and $this->softDelete) {
         $builder->whereNull($this->getQualifiedDeletedAtColumn());
     }
     return $builder;
 }