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();
 }
Example #2
0
 /**
  * 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;
 }
Example #3
0
 public function setUp()
 {
     parent::setUp();
     Model::clearBootedModels();
     Model::flushEventListeners();
 }
Example #4
0
 /**
  * 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();
 }
Example #5
0
 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);
 }
Example #6
0
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     Model::setDatasourceResolver($this->app['halcyon']);
     Model::setEventDispatcher($this->app['events']);
     Model::setCacheManager($this->app['cache']);
 }
Example #7
0
 /**
  * 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);
     }
 }