chenjiahao / swoft-orm
swoft orm laravel orm
v4.0
2020-03-18 01:18 UTC
Requires
- laravel/framework: ^5.5
- swoft/connection-pool: ~2.0.0
- swoft/framework: ~2.0.0
This package is not auto-updated.
Last update: 2024-12-19 00:04:27 UTC
README
兼容laravel的orm
namespace App\Model; use cjhswoftOrm\Model;
class A extends Model { /** * The table associated with the model. * * @var string */ protected $table = 'aaa';
protected $primaryKey = 'id';
protected $connection = 'db.pool';
public $timestamps = false;
/**
* @var array
*/
protected $fillable = ['a','b','c'];
}
\cjhswoftOrm\ConnectionFactory:: connection( 'db.pool')->transaction (function(){
$a = new \App\Model\A();
$a->a=1;
$a->b=1;
$a->c=1;
$a->save();
$a = new \App\Model\A();
$a->a=1;
$a->b=1;
$a->c=1;
$a->save();
});