Browse Source

fix settings edit not working

pull/260/head
Chris 6 years ago
parent
commit
aceed3d13b
  1. 2
      app/Http/Controllers/SettingsController.php
  2. 2
      app/Http/Middleware/CheckAllowed.php
  3. 8
      app/Setting.php
  4. 4
      resources/views/layouts/app.blade.php

2
app/Http/Controllers/SettingsController.php

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

2
app/Http/Middleware/CheckAllowed.php

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

8
app/Setting.php

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

4
resources/views/layouts/app.blade.php

@ -71,7 +71,7 @@
</div> </div>
</div> </div>
@endif @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') @yield('content')
<div id="config-buttons"> <div id="config-buttons">
@ -81,7 +81,9 @@
@endif @endif
<a id="dash" class="config" href="{{ route('dash', [], false) }}"><i class="fas fa-th"></i></a> <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> <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="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="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> <a id="settings" class="config" href="{{ route('settings.index', [], false) }}"><i class="fas fa-cogs"></i></a>

Loading…
Cancel
Save