Answer the question
In order to leave comments, you need to log in
Laravel. How to properly chain condition chain in ORM?
there are several conditions like
->where('status',1)
->whereDate('start_time', "<=", Carbon::now()->addWeeks($week)->format('Y-m-d'))
Program::orderBy('start_time', 'ASC')
->where('status',1)
->whereDate('start_time', "<=", Carbon::now()->addWeeks($week)->format('Y-m-d'))
->with('league')
->get();
publick function activ(){
$this->where('status',1)
}
publick function addWeeks($week = 1){
$this->whereDate('start_time', "<=", Carbon::now()->addWeeks($week)->format('Y-m-d'))
}
Program::orderBy('start_time', 'ASC')
->activ()
->addWeeks()
->with('league')
->get();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question