本文整理汇总了PHP中app\models\BaseModel类的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel类的具体用法?PHP BaseModel怎么用?PHP BaseModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BaseModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeRender
protected function beforeRender()
{
parent::beforeRender();
$user_id = $this->user->id;
if ($this->user->isLoggedIn() and $user_id != NULL) {
$css = $this->baseModel->getCss($user_id);
$this->template->userCss = $css->style;
} else {
$this->template->userCss = 1;
}
}
示例2: c
public function c($rq = null)
{
$type = ['employee' => 1, 'agency' => 2, 'doctor' => 3];
$rq = rq();
$rq['senderid'] = uid();
$rq['sendername'] = username();
if (he_is('agency')) {
$rq['org'] = sess('org');
}
if (he_is('employee')) {
$rq['org'] = sess('org');
}
// return his_chara()[0];
$rq['sendertype'] = $type[his_chara()[0]];
if (his_chara()[0] == 'agency') {
$rq['recipienttype'] = 1;
$rq['recipientid'] = 1;
$rq['recipientname'] = 'admin';
} elseif (his_chara()[0] == 'employee') {
$rq['recipienttype'] = $type[$rq['recipienttype']];
}
// 验证发信规则
$valid = $this->verify($rq);
if (!$valid) {
return ee(2);
}
$rq['sendtime'] = date("Y-m-d H:i:s");
return parent::c($rq);
}
示例3: beforeValidate
public function beforeValidate()
{
if (!$this->expires) {
$this->expires = strtotime(Yii::$app->params['user']['reset_timeout']);
}
return parent::beforeValidate();
}
示例4: initialize
public function initialize()
{
parent::initialize();
$this->setSource($this->className());
$this->belongsTo('user_id', 'App\\Models\\User', 'id', ['alias' => 'User', 'foreignKey' => ['message' => 'The user_id does not exist on the User model']]);
$this->belongsTo('provider_id', 'App\\Models\\Provider', 'id', ['alias' => 'Provider', 'foreignKey' => ['message' => 'The provider_id does not exist on the Provider model']]);
}
示例5: initialize
public function initialize()
{
parent::initialize();
$this->setSource($this->className());
$this->hasManyToMany('id', 'App\\Models\\Relationships\\EventHasHashTag', 'hashTag_id', 'event_id', 'App\\Models\\Event', 'id', ['alias' => 'Events']);
$this->hasManyToMany('id', 'App\\Models\\Relationships\\PhotoHasHashTag', 'hashTag_id', 'photo_id', 'App\\Models\\Photo', 'id', ['alias' => 'Photos']);
}
示例6: initialize
public function initialize()
{
parent::initialize();
$this->setSource($this->className());
$this->belongsTo('period_id', 'App\\Models\\Period', 'id', ['alias' => 'Period', 'foreignKey' => ['message' => 'The period_id does not exist on the Period model']]);
$this->hasOne('id', 'App\\Models\\Event', 'scheduling_id', ['alias' => 'Event']);
}
示例7: __construct
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
if (app()->environment() === 'production') {
$this->setConnection('mysql-hr');
}
}
示例8: initialize
public function initialize()
{
parent::initialize();
$this->setSource($this->className());
$this->hasOne('id', 'App\\Models\\Event', 'guestList_id', ['alias' => 'Event']);
$this->hasManyToMany('id', 'App\\Models\\Relationships\\Belong', 'guestList_id', 'user_id', 'App\\Models\\User', 'id', ['alias' => 'Users']);
}
示例9: initialize
public function initialize()
{
parent::initialize();
$this->setSource($this->className());
$this->hasOne('id', 'App\\Models\\User', 'rrpp_id', ['alias' => 'User']);
$this->hasMany('id', 'App\\Models\\Local', 'owner_id', ['alias' => 'Locals']);
}
示例10: r
public function r()
{
if (Input::get('log')) {
$this->eventFire('r', rq('id'));
}
return parent::r();
}
示例11: setAttribute
public function setAttribute($key, $value)
{
$isRememberTokenAttribute = $key == $this->getRememberTokenName();
if (!$isRememberTokenAttribute) {
parent::setAttribute($key, $value);
}
}
示例12: boot
protected static function boot()
{
parent::boot();
static::deleting(function ($image) {
Storage::delete('uploads/m/' . $image->path . $image->key);
});
}
示例13: boot
/**
* The "booting" method of the model.
*
* @return void
*/
public static function boot()
{
parent::boot();
static::saving(function ($item) {
$item->key = $item->key;
});
}
示例14:
function __construct($init = [])
{
if (is_array($init)) {
return parent::__construct($init);
} else {
$this->name = $init;
}
}
示例15: u
/**
* 更新
*/
public function u($rq = NULL)
{
$this->guarded = arr_except_vals($this->guarded, ['password']);
if (!$rq) {
$rq = rq();
}
return parent::u($rq);
}