我嘗試訪問我的tipos/index頁面時出現錯誤,我正在使用jerarey way generator的laravel 4框架來加速路由,控制器,模型的創建過程,等沒有關於model []的查詢結果
這是我的代碼:
路線:
Route::get('tipos/index',
array(
'as' => 'index',
'uses' => '[email protected]')
);
型號:
class Tipo extends Eloquent{
protected $guarded = array();
public static $rules = array(
'clave_tipo' => 'required',
'nombre_tipo' => 'required',
'status' => 'required',
'created_by' => 'required',
);
}
控制器:
class TiposController extends BaseController {
protected $tipo;
public function index()
{
$tipos = $this->tipo->all();
return View::make('tipos.index', compact('tipos'));
}
Especific路線在我master.blade:
{{ link_to('tipos/index', trans('common/messages.tipos'))}} |
index.blade:
@extends('layouts.master')
@section('content')
<h1>
Tipos
</h1>
<form name="form" id="form" method="post">
<a class="editar button clear" href="/sistema/crearTipo">Nuevo Tipo</a>
<input type="button" onclick="javascript:exportar();" value="Exportar" class="button" style="margin: 0px;">
<input type="hidden" name="format" id="format" value="yy-mm-dd">
<input type="hidden" name="excel" id="excel" value="false">
<br><br>
<iframe name="x" height="0" width="0" style="display: none;"></iframe>
<div class="title">
<form name="form" id="form" method="post">
<iframe name="x" height="0" width="0" style="display: none;"></iframe>
<table class="datatable" id="tipos">
<thead>
<th>CÓDIGO</th>
<th>DESCRIPCIÓN</th>
<th>EDITAR</th>
<th>ELIMINAR</th>
</thead>
</table>
<div class="foot">
</div>
</form>
</div>
@stop
而且出現這個錯誤:照亮\數據庫\雄辯\ ModelNotFoundException 無查詢結果的模型[Tipo]。
如果有人能幫助我將不勝感激!
您在數據庫中沒有記錄。在訪問視圖之前處理異常。 – 2014-10-30 16:34:17
我沒有看到'''protected $ table ='';'''你在模型中! – ArjanSchouten 2014-10-30 16:37:36
嗨,我添加到我的模型: protected $ table ='tipos'; 但仍然得到錯誤:模型[Tipo]沒有查詢結果。 – 2014-10-30 16:57:32