初始化仓库
This commit is contained in:
20
admin/components/ModelAgent.php
Normal file
20
admin/components/ModelAgent.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace admin\components;
|
||||
|
||||
use yii\db\ActiveRecord;
|
||||
|
||||
class ModelAgent
|
||||
{
|
||||
public $model;
|
||||
|
||||
public function __construct(ActiveRecord $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
$this->model = $this->model->$method(...$arguments);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user