SELECT performer."id", performer."user", "portfolio", "rating", "balance", performer."created_at"
FROM performer
INNER JOIN performer_subject ON performer.id = performer_subject.performer_id AND performer_subject.subject_id = :subject_id
where not exists(select 1 from "order" where performer.id = order.performer and order.completed = false)
ORDER BY rating
SELECT performer."id", performer."user", "portfolio", "rating", "balance", performer."created_at"
FROM performer
INNER JOIN performer_subject ON performer.id = performer_subject.performer_id AND performer_subject.subject_id = :subject_id
where not exists(select 1 from "order" where performer.id = order.performer)
ORDER BY rating
DB::table('posts')
->select('*')
->where('id', '>', $getPost->id)
->where('city', '=', $getPost->city)
->where('approve', '=', 1)
->orderByRaw('(id > ?) desc, id asс' , [$getPost->id])
->limit(10)
->get();
Post::where('status', 1)
->join('post_tag', 'posts.id', '=', 'post_tag.post_id')
->join('tags', 'tags.id', '=', 'post_tag.tag_id')
->select('posts.*', DB::raw('group_concat(tags.name) as tags_name'))
->groupBy('posts.id', 'posts.name', 'posts.content')->get();
Post::where('status', 1)
->select('posts.*', DB::raw('select group_concat(tags.name) as tags_name from post_tag join tags on tags.id=post_tag.tag_id where post_tag.post_id = posts.id'))->get();