C
C
Cathari2021-03-09 09:27:38
Laravel
Cathari, 2021-03-09 09:27:38

How to translate a MySQL-like query into Laravel Eloquent?

SELECT * FROM `books` WHERE books.type = 'rare' AND books.band - $value < $result

$books= DB::table('books')
                        ->where('type ','=', 'rare')
                        ->whereRaw('band - $value < $result')   // Syntax error

How it is possible to register dynamic variables in ->whereRaw? Or is it possible to translate the request in some other way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2021-03-09
@Cathari

Look what's there!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question