当前位置:Gxlcms > 数据库问题 > [转]Illuminate Database

[转]Illuminate Database

时间:2021-07-01 10:21:17 帮助过:15人阅读

composer require "illuminate/events" required when you need to use observers with Eloquent.

Once the Capsule instance has been registered. You may use it like so:

Using The Query Builder

$users = Capsule::table(‘users‘)->where(‘votes‘, ‘>‘, 100)->get();

Other core methods may be accessed directly from the Capsule in the same manner as from the DB facade:

$results = Capsule::select(‘select * from users where id = ?‘, array(1));

Using The Schema Builder

Capsule::schema()->create(‘users‘, function ($table) {
    $table->increments(‘id‘);
    $table->string(‘email‘)->unique();
    $table->timestamps();
});

Using The Eloquent ORM

class User extends Illuminate\Database\Eloquent\Model {}

$users = User::where(‘votes‘, ‘>‘, 1)->get();

For further documentation on using the various database facilities this library provides, consult the Laravel framework documentation.

 

[转]Illuminate Database

标签:timestamp   ble   text   cad   ref   boot   providing   mode   sam   

人气教程排行