【发布时间】:2019-11-15 07:28:59
【问题描述】:
我正在做的网站的管理方面存在问题。我在管理端包含了 4 个链接,但是当我点击其中任何一个时,我都会收到此错误:
SQLSTATE[42S02]: 未找到基表或视图:1146 表 'sonic.admins' 不存在(SQL: select * from
adminswhereid= peripherals limit 1)
我不知道那个 SQL 查询来自哪里,因为据我所知,我没有运行任何查询
我使用以下控制器作为一个断开链接的示例:
Route::resource('/admin/games', 'AdminGamesController', ['names'=>[
'index'=>'games.index',
'create'=>'games.create',
'store'=>'games.store',
'edit'=>'games.edit',
'show'=>'games.show',
'destroy'=>'games.destroy',
]]);
但是
Route::resource('/admin', 'AdminController', ['names'=>[
'index'=>'admin.index',
'create'=>'admin.create',
'store'=>'admin.store',
'edit'=>'admin.edit',
'show'=>'admin.show',
'destroy'=>'admin.destroy',
]]);
工作正常。
这是我用于上述示例路由的控制器:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class AdminGamesController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return 'test';
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
这里是链接
<div class="list-group list-group-flush">
<a href="{{route('home.index')}}" class="list-group-item list-group-item-action"><i class="fas fa-home"></i> Home</a>
<a href="{{route('games.index')}}" class="list-group-item list-group-item-action"><i class="fas fa-home"></i> Games</a>
<a href="{{route('figures.index')}}" class="list-group-item list-group-item-action"><i class="fas fa-user-friends"></i> Figures</a>
<a href="{{route('guides.index')}}" class="list-group-item list-group-item-action"><i class="fas fa-user-friends"></i> Guides</a>
<a href="{{route('peripherals.index')}}" class="list-group-item list-group-item-action"><i class="fas fa-user-tie"></i> Peripherals</a>
</div>
【问题讨论】:
-
我认为问题出在您的身份验证/访客检查中间件之一。
-
我删除了中间件,但它仍然在这样做
-
在 storage/logs/ 中查找堆栈跟踪,看看它是从哪里发生的。
-
我没有看到任何明显的东西
-
视图/布局中可能有一些帮助?
标签: php sql laravel laravel-5.8