* Illuminate\Database\Eloquent\Model extends * DynamicQuery 를 처리하기 위해 proxy, dynamic 관련 설정 요소 추가 * XE3 에서 Database column 이름을 Camel case 로 사용함에 따른 날짜 column 이름 수정 * 레코드 추가할 때 Xpressengine\Keygen\Keygen 을 이용한 id 자동 생성 기능
Автор: XE Developers (developers@xpressengine.com)
Наследование: extends Illuminate\Database\Eloquent\Model
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     DynamicModel::clearBootedModels();
     $this->app->singleton('xe.db.proxy', function ($app) {
         return ProxyManager::instance($app['xe.register']);
     });
     $this->app->singleton(['xe.db' => DatabaseHandler::class], function ($app) {
         $coupler = DatabaseCoupler::instance($app['db'], TransactionHandler::instance(), $app['xe.db.proxy'], new LaravelCache($app['cache']->driver('schema')));
         $proxyClass = $app['xe.interception']->proxy(DatabaseHandler::class, 'XeDB');
         return new $proxyClass($coupler, $app['config']->get('xe.database'));
     });
 }
Пример #2
0
 /**
  * Perform a model delete operation.
  *
  * @return void
  */
 protected function performDeleteOnModel()
 {
     parent::performDeleteOnModel();
     if ($this->division === true) {
         $clone = clone $this;
         $clone->table = static::TABLE_NAME;
         $clone->setKeysForSaveQuery($clone->newQueryWithoutScopes())->delete();
     }
 }
Пример #3
0
 /**
  * delete
  *
  * @param Model $item item
  *
  * @return bool|null
  * @throws \Exception
  */
 public function delete(Model $item)
 {
     return $item->delete();
 }
Пример #4
0
 /**
  * User constructor.
  *
  * @param array $attributes attributes
  */
 public function __construct(array $attributes = [])
 {
     $this->setProxyOptions(['group' => 'user']);
     parent::__construct($attributes);
 }
Пример #5
0
 /**
  * Get the foreign key name for the model.
  *
  * @return string
  */
 public function getForeignKey()
 {
     return property_exists($this, 'foreignKey') ? $this->{'foreignKey'} : parent::getForeignKey();
 }