I want to define blocks of query builder within my model: So it's cunctions might be used like this:
class Transactions extends Eloquent {
public function dateRange($from,$to){
return $this->whereBetween('date', [$from,$to]);
}
public function category($categ){
return $this->where(['categ' => $categ]);
}
...etc , more query block functions
}
so I could chain ans reuse these, like so:
$t = new Transactions();
dd($t->category($cat)->dateRange()->get())
or as i desire ...
$t2 = new Transactions();
dd($t2->dateRange()->get())
This (first example of usage) will thow A Call to undefined method Illuminate\Database\Query\Builder::dateRange()
p.s. second example works, but i need to chain more than one of Qblocks to my model instance...