【发布时间】:2015-11-12 20:15:41
【问题描述】:
我正在使用 Laravel 5.1 和数据表 (yajra/laravel-datatables-oracle)。 我想在我的表中添加指向数据的链接,但它不起作用。我想问题是我输入参数的方式,应该不同。
PS:当我删除参数时,它会起作用并显示链接:categorie/afficher
public function anyData()
{
$categories = \App\Categorie::all();
return Datatables::of($categories)
->editColumn('nom', '<a href="'.route('categorie-afficher', $id).'" >{{$nom}}</a>')
->make(true);
}
这是我的路线:
Route::get('/categorie/afficher/{id}', [
'as' => 'categorie-afficher',
'uses' => 'CategorieController@afficher'
]);
程序报错:undefined $id。当我输入一个整数值而不是 $id 时,它可以工作!
->editColumn('nom', '<a href="'.route('categorie-afficher', 1).'">{{$nom}}</a>')
【问题讨论】:
-
我认为您在 $id 之后缺少一个冒号)。 " 应该是 $id)。 " '
-
谢谢,但没有。那不是问题。冒号没问题:)
标签: laravel datatables