Home > PHP Framework > Laravel > DB::RAW() syntax usage example in Laravel framework

DB::RAW() syntax usage example in Laravel framework

little bottle
Release: 2019-04-24 17:01:47
forward
7503 people have browsed it

The main content of this article introduces the DB::RAW() syntax and attaches the usage code. I hope interested friends can learn about it.

I encountered a problem in the project before. It was very inconvenient to use laravel's query constructor for complex sql queries. It was a headache to stitch together a long list of various query conditions; then I wanted to use the native sql statement to query, and then laravel's paginate() paging method cannot be used; at this time, the DB::raw() method comes in handy!

As shown in the picture:

Result:

The principle of this syntax is to query your The result set is treated as a temporary table, and then paging is performed using laravel's query builder syntax. I hope it will be helpful to you.

Related tutorials: laravel video tutorial

The above is the detailed content of DB::RAW() syntax usage example in Laravel framework. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Latest Issues
Composer cannot install laravel
From 1970-01-01 08:00:00
0
0
0
Laravel Space/laravel-backup cannot be installed
From 1970-01-01 08:00:00
0
0
0
Laravel 5.1 Login laravel comes with it No more
From 1970-01-01 08:00:00
0
0
0
Why thinkphp has better performance than laravel?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template