John Davidson

php - Raw Expression in Laravel

0 comments
Message:


I have to refactor some code for work, but i´m stuck with this statement: DB::raw('MAX(cred.id) as Last_id').
Does anyone know how to replase it using Laravel´s Query builder?



My Answer:
You can replace the DB::raw() statement with the following code using Laravel's Query Builder:

php
->selectRaw('MAX(cred.id) as Last_id')


This will achieve the same result as the DB::raw() statement in your code.

Rate this post

3 of 5 based on 3025 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us