As I've understood so far, laravel has some functions which are related to database, and I have to use them to write a query. like these:
from()
join()
where()
whereIn()
hasOne()
hasManey()
Ok well, I'm a newbie in Laravel and honestly I'm confused now. I mean, yes, writing a simple query by functions above is possible, but what about complex queries? how can I use functions above to implement this query:
SELECT count(*) as total_count
t1.col1,
t1.col2,
t2.col1,
CASE WHERE t1.col4 IS NULL THEN 1 ELSE 'something' END as sth,
(SELECT col2 FORM table3 WHERE col1 = ?) as related_id
FROM table1 t1
JOIN table2 t2
JOIN t1.col1 = t2.col3
WHERE t1 = ?
GROUP BY t1.co1, t1.col2, t2.col1
ORDER BY t1.col2, t2.col1
LIMIT 1,?
Isn't there any Laravel's method to allow me use pure-mysql codes in it?