Closed imajim closed 8 years ago
Print into the controller? What do you mean? Do you wanna know how the query looks like?
if so, try
echo $theQuery
in fact, i would like print the sql :
"select ..... Where ...and ...or ... and...."
var_dump($query) print a "Illuminate\Database\Eloquent\Builder"
oke, more code please!
how does your controller, or that part look like?
@imajim if i have understood right this is what your are looking for
$results = User::where(function($q) use ($request) {
$q->orWhere('email', 'like', '%john@example.org%');
$q->orWhere('first_name', 'like', '%John%');
$q->orWhere('last_name', 'like', '%Doe%');
})->toSql();
dd($results)
instead of the get()
or first()
use toSql()
please see this for more information link
ahh yes ! it's working. Thanks ^^
@giwrgos88 Thanks!
anytime!!
hello,
How to print the current query in controller ?
I have multiple conditions and i must debug it.
thx to help me ^^