public function getSetting($name)
    {
        if ($this->hasName($name) === false) {
            throw NameDoesNotExist::named($name, $this->alias());
        }
        /** @var SettingRepository $repository */
        $repository = app(SettingRepository::class);
        $query = $repository->getNewQuery();
        $query = $this->makeQueryFiltered($query);
        $setting = $query->where('name', $name)->first();
        if (!$setting) {
            $defaultValue = $this->getDefault($name);
            $this->update($name, $defaultValue);
            $setting = $query->first();
        }
        return $setting;
    }
public function getSetting($name)
    {
        if ($this->hasName($name) === false) {
            throw NameDoesNotExist::named($name, $this->alias());
        }
        /** @var SettingRepository $repository */
        $repository = app(SettingRepository::class);
        $query = $repository->getNewQuery();
        $query = $this->makeQueryFiltered($query);
        $setting = $query->where('name', $name)->first();
        if (!$setting) {
            $defaultValue = $this->getDefault($name);
            $this->update($name, $defaultValue);
            $setting = $query->first();
        }
        return $setting;
    }
public function getSetting ( $ name ) { if ( $ this -> hasName ( $ name ) === false ) { throw NameDoesNotExist :: named ( $ name , $ this -> alias ( ) ) ; } /** @var SettingRepository $repository */ $ repository = app ( SettingRepository :: class ) ; $ query = $ repository -> getNewQuery ( ) ; $ query = $ this -> makeQueryFiltered ( $ query ) ; $ setting = $ query -> where ( 'name' , $ name ) -> first ( ) ; if ( ! $ setting ) { $ defaultValue = $ this -> getDefault ( $ name ) ; $ this -> update ( $ name , $ defaultValue ) ; $ setting = $ query -> first ( ) ; } return $ setting ; }
Get a specific setting. If not exist, create the default one and return it.
@param $name
@return Setting
Get a specific setting . If not exist create the default one and return it .