2015-03-02 111 views
1

我試圖在Laravel 5配置chumper數據表,但我得到關於視圖Laravel 5 DataTable的錯誤

View [views.template] not found. (View: C:\wamp\www\laravel- 
master\resources\views\songs\index.blade.php) 

誰能告訴我,這可能是原因的錯誤?

Chumper數據表上沒有laravel 5中,但下面的鏈接說,這是在laravel配置5

http://jayeshmagare.blogspot.in/2015/02/using-chumper-datatable-in-laravel-5.html

真的,需要這個數據表中。

這裏,是我的控制器,路線和查看 - >

控制器

public function getDatatable() 
{ 
    return Datatable::collection(Songs::all(array('id','title'))) 
    ->showColumns('id', 'title') 
    ->searchColumns('title') 
    ->orderColumns('id','title') 
    ->make(); 
} 

路線

$router->resource('songs','SongsController'); 
get('api/songs',['as'=>'api.songs','uses'=>'[email protected]']); 

查看

<div class="box-body table-responsive"> 
{!! Datatable::table() 
->addColumn('ID','Date')  
->setUrl(route('api.songs'))  
->noScript() 
->render() 
->script(); !!} 
</div> 
+0

FWIW,你不應該在視圖中使用類似的外牆。控制器應該傳遞結果集。分離你的邏輯。 – James 2015-03-02 12:52:02

+0

此錯誤與視圖有關。出現Chumper(我從未使用它)無法在其包中找到模板視圖。它正在您的應用程序的視圖文件夾中查看包視圖文件夾(Github repo將其顯示在chumper/datatable/src/views中)。您是否使用作曲家安裝Chumper? – Joe 2015-03-02 12:55:34

+0

我猜沒有人有答案 – 2015-03-03 04:21:19

回答

1

鑑於文件替換下面的代碼。它將工作

{!! Datatable::table() 
    ->addColumn('ID','Date')  
    ->setUrl(route('api.songs')) 
    ->render() !!}