简体   繁体   English

"Laravel DataTable - $dataTable 未定义"

[英]Laravel DataTable - $dataTable is undefined

I created a Model, Controller, Factory and dataTable files, but laravel keeps showing me the error $dataTable is undefined<\/code>我创建了一个模型、控制器、工厂和 dataTable 文件,但 laravel 不断向我显示错误$dataTable is undefined<\/code>

How come?怎么来的? Is it a routing issue or I'm not linking the controller to the blade correctly?是路由问题还是我没有将控制器正确链接到刀片?

My controller:<\/strong>我的控制器:<\/strong>

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\DataTables\DataEntry\ReportsDataTable;

class ReportsController extends Controller
{
    public function index(ReportsDataTable $dataTable)
    {
        return $dataTable->render("pages.dataEntry.reports.index");
    }
}
public function index()
{
    return ReportsDataTable::all()->render("pages.dataEntry.reports.index");
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM