Tag:Query Builder

  • Example analysis of laravel framework database operation, query builder and eloquent ORM operation

    Time:2021-11-17

    This paper describes the laravel framework database operation, query builder and eloquent ORM operation. Share with you for your reference, as follows: 1. Connect to database The configuration file of laravel connecting to the database is located in config / database.php. The connection field contains the configuration information of the database supported by laravel. You […]

  • Detailed explanation of usage examples of laravel 5.1 framework database query builder

    Time:2021-10-20

    This article describes the usage of database query builder of laravel 5.1 framework. Share with you for your reference, as follows: Today, let’s talk about query builder. It is simpler than running native SQL, and it has a wide range of operations. 1. Query results Let’s take a look at its syntax: public function getSelect() […]

  • Example analysis of curd writing method (query builder) of laravel 5.6 framework operation data

    Time:2021-8-17

    This paper describes the curd writing method (query builder) of operation data in laravel 5.6 framework. Share with you for your reference, as follows: Laravel 5.6 database operation – Query Builder <?php //Laravel 5.6 syntax demo example namespace App\Http\Controllers;// Name the name under the control app space use Illuminate\Support\Facades\DB;// Operating database with DB use App\Http\Controllers\Controller;// […]

  • Example of using query generator query() in yii2 framework

    Time:2021-4-3

    This article describes the use of query generator query () in yii2 framework. The details are as follows: Yii / db / query in yii2 provides us with rich methods to build complex SQL statements. The biggest difference between query () and create command is that the latter directly uses the SQL statements we have […]

  • A simple example of query builder for laravel framework

    Time:2019-11-30

    An example of this article describes the laravel framework query builder. To share with you for your reference, as follows: public function query(){ //New data //$bool = DB::table(‘wd_user’)->insert([‘username’=>’jack’]); //dd($bool); //New data并且获取到自增id //$id = DB::table(‘wd_user’)->insertGetid([‘username’=>’Tom’]); //dd($id); //Add multiple data //$bool = DB::table(‘wd_user’)->insert([[‘username’=>’a’],[‘username’=>’d’]]); //dd($bool); //Update data //$bool = DB::table(‘wd_user’)->where(‘uid’,7)->update([‘username’=>’tom’]); //dd($bool); // self increment //$bool = DB::table(‘wd_user’)->increment(‘age’,1); // […]