为了账号安全,请及时绑定邮箱和手机立即绑定

Laravel 6 目标类 [App\Http\Controllers\Admin\Tracker]

Laravel 6 目标类 [App\Http\Controllers\Admin\Tracker]

HUX布斯 2023-08-21 16:58:01
我正在尝试删除一条记录,但收到此错误,该类不存在,我正在使用 Laravel 6,我希望您的帮助或建议我不知道命名空间是否错误,尽管我已经检查过并且没问题,还是控制器中的某些内容我已经查看了这些方法,但找不到解决方案我附上了我的驱动程序文件和路径控制器<?phpnamespace App\Http\Controllers\Admin;use App\Events\InstanceCreated;use App\Pesvial\City;use App\Pesvial\Instance;use App\Pesvial\Tracker;use App\Pesvial\TrackingServer;use Illuminate\Http\Request;use App\Pesvial\Vehicle;use App\Http\Controllers\Controller;use Auth;class TrackerController extends Controller{    public function __construct( )    {        $this->uri = 'tracker';        $this->perm = str_replace('_', '.', $this->uri);        //$subdomain = \Route::current()->parameter('subdomain');        $this->middleware('permission:'. $this->perm .'.create', ['only' => ['create', 'store']]);        $this->middleware('permission:'. $this->perm .'.create', ['only' => ['create', 'store']]);        $this->middleware('permission:'. $this->perm .'.read', ['only' => ['show']]);        $this->middleware('permission:'. $this->perm .'.update', ['only' => ['edit', 'update','activate', 'confirmActivate']]);        $this->middleware('permission:'. $this->perm .'.delete', ['only' => ['destroy', 'confirmDestroy']]);        $this->middleware("one.permission:{$this->perm}.create&{$this->perm}.read&{$this->perm}.update&{$this->perm}.delete",            ['only' => ['index']]);    }    /**     * Display a listing of the resource.     *     * @return \Illuminate\Http\Response     */    public function index(Request $request)    {        $q = null;        $uri = $this->uri;        $user = Auth::user();        $perm = $this->perm;        $title = trans_choice('app.' . $uri . '.title', 2);        $items = Tracker::orderBy('purchased_at', 'desc');        if($request->has('q')){            $q = $request->input('q');            $items->where('id', 'like', "%$q%");        }    }路线 Route::get('tracker/{post}/destroy', 'Admin\Tracker@confirmDestroy');         Route::resource('tracker', 'Admin\TrackerController');
查看完整描述

1 回答

?
一只名叫tom的猫

TA贡献1906条经验 获得超3个赞

我想你是在一个团体中,输入这条路线:

Route::get('tracker/{post}/destroy', 'Admin\Tracker@confirmDestroy');

您忘记了控制器后缀:

Route::get('tracker/{post}/destroy', 'Admin\TrackerController@confirmDestroy');


查看完整回答
反对 回复 2023-08-21
  • 1 回答
  • 0 关注
  • 94 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信