protected function seedSampleSourceAndData() { $datasource = new FileDatasource($this->themePath, new Filesystem()); $resolver = new Resolver(['theme1' => $datasource]); $resolver->setDefaultDatasource('theme1'); Model::setDatasourceResolver($resolver); LocaleModel::unguard(); LocaleModel::firstOrCreate(['code' => 'fr', 'name' => 'French', 'is_enabled' => 1]); LocaleModel::reguard(); $this->recycleSampleData(); }
/** * Get the cache object with tags assigned, if applicable. * * @return \Illuminate\Cache\CacheManager */ protected function getCache() { $cache = $this->model->getCacheManager()->driver($this->cacheDriver); return $this->cacheTags ? $cache->tags($this->cacheTags) : $cache; }
public function setUp() { parent::setUp(); Model::clearBootedModels(); Model::flushEventListeners(); }
/** * Receives the invalid model and sets the {@link model} and {@link errors} properties. * @param Model $model The troublesome model. */ public function __construct(Model $model) { $this->model = $model; $this->errors = $model->errors(); $this->evalErrors(); }
protected function setDatasourceResolver() { $theme1 = new FileDatasource(__DIR__ . '/../fixtures/halcyon/themes/theme1', new Filesystem()); $this->resolver = new Resolver(['theme1' => $theme1]); $this->resolver->setDefaultDatasource('theme1'); $theme2 = new FileDatasource(__DIR__ . '/../fixtures/halcyon/themes/theme2', new Filesystem()); $this->resolver->addDatasource('theme2', $theme2); Model::setDatasourceResolver($this->resolver); }
/** * Bootstrap the application events. * * @return void */ public function boot() { Model::setDatasourceResolver($this->app['halcyon']); Model::setEventDispatcher($this->app['events']); Model::setCacheManager($this->app['cache']); }
/** * Save the object to the theme. * * @param array $options * @return bool */ public function save(array $options = null) { try { parent::save($options); } catch (Exception $ex) { $this->throwHalcyonSaveException($ex); } }