@@ -2,9 +2,14 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
-
+ use Illuminate\Support\Facades\View;
+ use Illuminate\Support\Facades\Session;
class CommonController extends Controller{
+ public function __construct()
+ {
+ $user = session('user');
+ View::share('user',$user);
+ }
}
@@ -12,6 +12,7 @@ namespace App\Http\Controllers\Admin;
public function index()
{
$data = Tablelist::where('status','>','5')->orderby('id','asc')->paginate(10);
+
return view('admin.index',compact('data'));
@@ -173,11 +173,7 @@ class TableController extends CommonController
$table = json_decode($table,true);
$table = array_merge($table,$json);
$user = session('user');
- if($user->role>5){
- $table['judge']=6;
- }else{
- $table['judge']=0;
- }
+ $table['judge']=$user->role;
$table = (object)$table;
if($table_type_id == 1){
@@ -137,8 +137,10 @@
<td>{{ $list->used }}</td>
<td><a href="{{ url('/table/'.$list->id.'/edit') }}" class="btn btn-primary btn-sm">
<i class="fa fa-search"></i> 查看</a>
- <a href="{{ url('/table/'.$list->id.'/edit') }}" class="btn btn-success btn-sm">
- <i class="fa fa-pencil"></i> 编辑</a>
+ @if($user->role>5)
+ <a href="{{ url('/table/'.$list->id.'/edit') }}" class="btn btn-success btn-sm">
+ <i class="fa fa-pencil"></i> 编辑</a>
+ @endif
</td>
</tr>
@endforeach