Laravel 7/6 Eloquent selectRaw Example

10-Apr-2023

.

Admin

In this post, we will learn eloquent select raw query. i explained simply step by step laravel selectraw example Here you will learn laravel selectraw sum. This tutorial will give you simple example of selectraw in laravel. You just need to some step to done laravel select raw max.

you will any table select to raw then change particular raw data.you can use select raw in example.

First of all we will example using selectRaw(), so let's see bellow example:

Example 1:


SQL Query :

"select price * ? as price_with_gst from `users`"

Laravel Query :

public function index()

{

$products = Product::selectRaw('price * ? as price_with_gst', [18])->get();

dd($products);

}

It will help you....

#Laravel 7

#Laravel

#Laravel 6