我的目標Laravel SQL請求太大
是創建拉姆達用戶一個簡單的DB導航。 對於這一點,我有一個包含所有的數據庫表名
,並在中心頁面,我想數據側邊欄。 這裏是我的表名:
administratif
equipement
erreur
etablissement
interface_eth_routeur
interface_eth_switch
interface_ip_routeur
latence
mainteneur
routeur_arp
routeur_gsu
routeur_su
salle_visio
site
switch
switch_arp
switch_module
現在,有代碼: routes.php文件
Route::get('navigateur_bdd', array('uses' => '[email protected]_bdd', 'as' => 'navigateur_bdd'));
Route::get('navigateur_bdd/{table_name}', array('uses' => '[email protected]_show_table', 'as' => 'bdd_show_table'));
HOMECONTROLLER.PHP
public function navigateur_bdd()
{
$table_name = DB::select('SHOW TABLES');
return View::make('navigateur_bdd', array('which_actif' => 3, 'table_name' => $table_name));
}
public function bdd_show_table($argument = NULL) {
$selected_table = DB::table($argument)->get();
$table_name = DB::select('SHOW TABLES');
return View::make('navigateur_bdd', array('which_actif' => 3, 'table_name' => $table_name, 'selected_table' => $selected_table));
}
第一個功能是主視圖,當用戶進入這個區域時。
當用戶點擊TABLE_NAME從主視圖
NAVIGATEUR_BDD.BLADE.PHP
<div id="sidebar-wrapper">
<ul class="sidebar-nav" id="sidebar">
<li class="well">Liste des tables</li>
@for ($i = 0 ; $i < count($table_name); $i ++)
<li><a href="{{ URL::to('navigateur_bdd/' . $table_name[$i]->Tables_in_MYNET)}}">{{$table_name[$i]->Tables_in_MYNET}}</a></li>
@endfor
</ul>
</div>
什麼現在hapenning的側邊欄時,使用第二函數? 點擊表名稱,如「administratif」或「ERREUR」是OK
但點擊其上有類似「routeur_」 顯示空白頁,沒有錯誤的前綴表名。 我沒有在database.php中設置任何前綴,因爲並非我所有的表都有前綴 我怎麼能解決這個問題?
編輯:一些帶有前綴的表正在工作。不是所有的,我不知道爲什麼......就像 「開關」 的前綴:
"switch"
"switch_module"
正在努力,但不
"switch_arp"
routeur_su
routeur_gsu
正在努力但不
routeur_arp
經過調查,我在有很多行的表上有空白頁(例如110 000)(用dd($ selected_table)嘗試); 所以這改變了我的問題的標題: 我如何將這110000行存儲在變量中?
你能首先確保正確的控制器? – lukasgeiter 2014-11-21 13:14:18
這是正確的。 每個表的名稱看起來像這樣是正確的: string'interface_ip_routeur'(length = 20) – 2014-11-21 13:37:11
如果您使用'$ selected_table'做同樣的事情? – lukasgeiter 2014-11-21 13:44:15