fix settings edit not working

This commit is contained in:
Chris 2018-10-15 14:35:14 +01:00
parent 10b70d4a09
commit aceed3d13b
4 changed files with 12 additions and 4 deletions

View file

@ -13,6 +13,7 @@ class SettingsController extends Controller
{
public function __construct()
{
$this->middleware('allowed');
}
/**
@ -20,7 +21,6 @@ class SettingsController extends Controller
*/
public function index()
{
User::checkAuthOrLogin();
$settings = SettingGroup::with([
'settings',
])->orderBy('order', 'ASC')->get();

View file

@ -29,6 +29,8 @@ class CheckAllowed
}
if($route == 'dash') {
//print_r(User::all());
//die("here".var_dump($current_user->password));
if((bool)$current_user->public_front === true) return $next($request);
}

View file

@ -88,8 +88,12 @@ class Setting extends Model
public function getEditValueAttribute()
{
$user = $this->user();
$this->value = $this->users()->where('id', $user->id)->first()->pivot->value;
if((bool)$this->system === true) {
$value = self::_fetch($this->key);
} else {
$value = self::fetch($this->key);
}
$this->value = $value;
switch($this->type) {
case 'image':
$value = '';

View file

@ -71,7 +71,7 @@
</div>
</div>
@endif
<a href="{{ route('user.select') }}">Switch User</a>
<a style="background: rgba(0,0,0,0.6); position: absolute; padding: 5px; color: white; text-align: center; top:0; left: 0; right: 0;" href="{{ route('user.select') }}">Switch User</a>
@yield('content')
<div id="config-buttons">
@ -81,7 +81,9 @@
@endif
<a id="dash" class="config" href="{{ route('dash', [], false) }}"><i class="fas fa-th"></i></a>
@if(App\User::currentUser()->id === 1)
<a id="users" class="config" href="{{ route('users.index', [], false) }}"><i class="fas fa-user"></i></a>
@endif
<a id="items" class="config" href="{{ route('items.index', [], false) }}"><i class="fas fa-list"></i></a>
<a id="folder" class="config" href="{{ route('tags.index', [], false) }}"><i class="fas fa-tag"></i></a>
<a id="settings" class="config" href="{{ route('settings.index', [], false) }}"><i class="fas fa-cogs"></i></a>