1
Laravel 4 응용 프로그램에서 모델에 네임 스페이스를 사용하려고합니다.내 모델의 네임 스페이스를 시도 할 때 '모델 Eloquent'클래스가 없습니다.
모델/Fix.php
<?php
namespace Models; // Namespace Declaration
class Fix extends Eloquent {
public static function getFixes() {
return DB::table('fixes')->get();
}
}
?>
FixController.php
<?php
class FixController extends BaseController {
public function showFix() {
$fixes = Models\Fix::getFixes(); // Referring to Fix Class in Models namespace
return View::make('partials.fix', array(
'fixes' => $fixes,
));
}
}
?>
이 일을, 나는 다음과 같은 오류가 나타납니다
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Class 'Models\Fix' not found
$fixes = Models\Fix::getFixes();
이을 다음을210 터미널 창에서 composer dump-auto
을 사용하고 다시 실행 해 보았습니다 ... 다음 오류를 찾으려면 다음을 수행하십시오.
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Class 'Models\Eloquent' not found
class Fix extends Eloquent {
다시 그냥 약간의 질문 : 네임 스페이스 클래스'Eloquent' 인에서? – hakre
나는 잘 몰라. 나는 http://driesvints.com/blog/laravel-4- learnarnings-week-2/에서 약간의 힌트를 주셔서 감사합니다. :) – Gravy