Laravel 7/6 Eloquent selectRaw Example

Laravel 6 , Laravel , Laravel 7

Nicesnippets

2839

05-02-2020


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....


Recommended Posts