lundi 30 mars 2020

How can i use scope in laravel query builder

I use laravel query builder instead Eloquent. Now, i have a lot of repeating joins. How can I use them without standard models scope in my query?

Simple:

public function getUserCourse(int $user_id)
{
return DB::table($this->table)
->select($this->table.'.id','title','description')
->join('user_course', $this->table.'.id','=','user_course.course_id')
->where('user_course.user_id','=',1)
->where('status','=', 0)
->get();
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/39nxgJi
via IFTTT

Aucun commentaire:

Enregistrer un commentaire