/** * 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')); }); }
/** * 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(); } }
/** * delete * * @param Model $item item * * @return bool|null * @throws \Exception */ public function delete(Model $item) { return $item->delete(); }
/** * User constructor. * * @param array $attributes attributes */ public function __construct(array $attributes = []) { $this->setProxyOptions(['group' => 'user']); parent::__construct($attributes); }
/** * Get the foreign key name for the model. * * @return string */ public function getForeignKey() { return property_exists($this, 'foreignKey') ? $this->{'foreignKey'} : parent::getForeignKey(); }