Dr.*_*Neo 4 php laravel laravel-4
在Controller中,当我试图从模型中调用函数时,它通过异常
Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR)
Class 'Illuminate\Database\Eloquent' not found
Run Code Online (Sandbox Code Playgroud)
控制器很简单,我用来创建名称空间来管理子目录控制器和模型
<?php
namespace Manage ;
use Illuminate\Support\Facades\View;
use Illuminate\Routing\Controller;
class BaseController extends Controller {
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected $layout = 'manage.layouts.master';
protected function setupLayout()
{
if ( ! is_null($this->layout))
{
$this->layout = View::make($this->layout)->with(Dashboard::all());
}
}
}
Run Code Online (Sandbox Code Playgroud)
和模型
<?php
namespace Manage ;
use Illuminate\Database\Eloquent;
class Dashboard extends Eloquent{
protected $table = 'admin_dashboard_sidebar';
//put your code here
}
Run Code Online (Sandbox Code Playgroud)
Ant*_*iro 13
该类是模型:
use Illuminate\Database\Eloquent\Model as Eloquent;
Run Code Online (Sandbox Code Playgroud)
要不就
use Eloquent;
Run Code Online (Sandbox Code Playgroud)
最后一个是您可以在您的课程中找到的课程的别名app/config/app.php
.
归档时间: |
|
查看次数: |
8923 次 |
最近记录: |