Commit 77b1d8cd authored by Nicolas Widart's avatar Nicolas Widart

Merge commit '9e9f8095'

* commit '9e9f8095':
  Squashed 'Modules/Setting/' changes from 56f557f5..7bcb95b
parents 0e41ea66 9e9f8095
......@@ -162,8 +162,23 @@ class EloquentSettingRepository extends EloquentBaseRepository implements Settin
* @param string $module Module name
* @return mixed
*/
private function findByModule($module)
public function findByModule($module)
{
return $this->model->where('name', 'LIKE', $module . '_%')->get();
}
/**
* Find the given setting name for the given module
* @param $settingName
* @param $module
* @return mixed
*/
public function findSettingForModule($settingName, $module = null)
{
if (is_null($module)) {
return $this->model->where('name', 'LIKE', "%{$settingName}")->first();
}
return $this->model->where('name', 'LIKE', "{$module}_{$settingName}")->first();
}
}
......@@ -32,4 +32,19 @@ interface SettingRepository extends BaseRepository
* @return mixed
*/
public function savedModuleSettings($module);
/**
* Find settings by module name
* @param string $module
* @return mixed
*/
public function findByModule($module);
/**
* Find the given setting name for the given module
* @param $settingName
* @param $module
* @return mixed
*/
public function findSettingForModule($settingName, $module = null);
}
<?php $settingName = $module . '_' . $setting; ?>
<div class='form-group'>
{!! Form::label($settingName . "[$lang]", $moduleInfo['description']) !!}
<?php if (isset($settings[$settingName])): ?>
{!! Form::input('number', $settingName . "[$lang]", Input::old($settingName . "[$lang]", $settings[$settingName]->translate($lang)->value), ['class' => 'form-control', 'placeholder' => $moduleInfo['description']]) !!}
<?php else: ?>
{!! Form::input('number', $settingName . "[$lang]", Input::old($settingName . "[$lang]"), ['class' => 'form-control', 'placeholder' => $moduleInfo['description']]) !!}
<?php endif; ?>
</div>
<?php $settingName = $module . '_' . $setting; ?>
<div class="checkbox">
<?php foreach($moduleInfo['options'] as $value => $optionName): ?>
<label for="{{ $optionName . "[$lang]" }}">
<input id="{{ $optionName . "[$lang]" }}"
name="{{ $settingName . "[$lang]" }}"
type="radio"
class="flat-blue"
{{ isset($settings[$settingName]) && (bool)$settings[$settingName]->translate($lang)->value == $value ? 'checked' : '' }}
value="{{ $value }}" />
{{ $optionName }}
</label>
<?php endforeach; ?>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment