Example #1
0
 /**
  * Set a meta value by key
  *
  * @param $key
  * @param $value
  */
 public function setMeta($key, $value)
 {
     $this->loadMetaData();
     if ($this->metaData->has($key)) {
         $this->metaData[$key]->value = $value;
     } else {
         $this->metaData[$key] = $this->newMetaModel(['key' => $key, 'value' => $value]);
     }
 }
 /**
  * @param array $setting
  * @return mixed
  * @throws Exception
  */
 protected function settingGetType(array $setting)
 {
     if (!static::$types) {
         static::$types = ThemeSettingType::all()->keyBy('name');
     }
     if (!static::$types->has($setting['type'])) {
         throw new Exception('Invalid setting type provided');
     }
     return static::$types->get($setting['type']);
 }
Example #3
0
 /**
  * Determine whether the authenticated user has the given permission.
  *
  * @param string $permission
  * @param bool   $for_artists
  *
  * @return boolean
  */
 public function hasPermission($permission, $for_artists = null)
 {
     // If the permissions haven't been loaded yet, load them first so that
     // we can check for the required permission.
     if (!$this->permissions) {
         $this->permissions(Which::section(), $for_artists);
     }
     return $this->permissions->has($permission);
 }