public function hasPrivilegeOnRoute() { $privilege = Privilege::find()->where("route = :route", [":route" => '//' . \Yii::$app->requestedRoute])->one(); if (is_null($privilege)) { return true; } return $this->hasPrivilege($privilege->name); }
public function getLoginPrivilege() { return $this->hasOne(Privilege::className(), ['id' => 'privilege_id'])->where('privilege.name = :name', [':name' => '统计后台登录'])->via('grant'); }
public function getPrivileges() { return $this->hasMany(Privilege::className(), ['id' => 'privilege_id'])->via('grants'); }