현재 laravel 4.1에서 laravel 5.4로 이전 사이트를 포팅 중입니다. 이미 (오류 로그 도움이) 작은 많은 변화를 구현하지만, 나는 다음과 같은 모델을 사용 붙어 오전 : 나는 컨트롤러에서 호출하기 위해 노력하고laravel 5.4 웅변 모델 로딩, 4.1 프로젝트에서 포팅
namespace App;
class navire extends Eloquent
{
protected $table = 'navire';
public function user()
{
return $this->belongsTo('user');
}
public function getId()
{
return $this->id;
}
}
을 :
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Input;
use App\navire;
class UserController extends Controller
{
public function somefunc()
{
// ....
$navire = \navire::where('user_id',$user->id)->get()->take(1);
}
}
사용하여 많은 일을 시도 "... 사용"또는 시작 부분에 \로 전화, 아무것도 지금까지 오류
exemples 일 없다 :
local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'App\Http\Controllers\navire' not found' in /home/user/www/app/Http/Controllers/UserController.php:30
local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'App\Http\Controllers\navire' not found' in /home/user/www/app/Http/Controllers/UserController.php:30
local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'App\navire' not found' in /home/user/www/app/Http/Controllers/UserController.php:32
local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'navire' not found' in /home/user/www/app/Http/Controllers/UserController.php:32
를
이미 dumpautoload를 호출했습니다.
클래스 \ App \ navire : 'Class'App \ Http \ Controllers \ navire '를 사용하지 않고 –
@LeaTano를 호출 할 때 \'클래스 'App \ Eloquent'가 아닌 클래스를 \ 제거하십시오. ' –
class navire extends \ Eloquent가 문제를 해결했습니다. thx :) –