양식에서 수집하려고하는 데이터의 모델을 인식하지 못하는 곳에서 작성한 Eloquent Repository에 문제가 있습니다. 내 모델을 Eloquent Repository의 네임 스페이스에 복사 했는데도 여전히 인식되지 않습니다.Laravel PHP : Eloquent Repository가 모델을 인식하지 못합니다.
웅변 저장소 (응용 프로그램 \ 한국 전기 \ 저장소 \ 웅변 \ EloquentVideoRepository.php) :
<?php namespace Acme\repositories\Eloquent;
use acme\repositories\VideoRepository;
/* Tried copying the 'Video' model into the same
namespace as this Eloquent Repository but it is not being recognized. */
use acme\repositories\Video;
class EloquentVideoRepository implements VideoRepository {
public function all()
{
return Video::all();
}
/* This function below generates an error since the 'Video' class
is not found from my 'Video' Model */
public function create($input)
{
return Video::create($input);
}
}
모델 (응용 프로그램 \ 모델 Video.php을 \) :
<?php
/* Original Line of code below that generated the error:
class Video extends Eloquent
*/
/* EDIT: I put a backslash in front of Eloquent
and now the model is recognized.
*/
class Video extends \Eloquent {
/**
* The table used by this model
*
* @var string
**/
protected $table = 'videos';
/**
* The primary key
*
* @var string
**/
protected $primaryKey = 'video_id';
/**
* The fields that are guarded cannot be mass assigned
*
* @var array
**/
protected $guarded = array();
/**
* Enabling soft deleting
*
* @var boolean
**/
protected $softDelete = true;
}
I 위의 모델을 'app \ acme \ repositories'에 복사했습니다. 표시
오류 메시지 : 심지어이 네임 스페이스에 모델을 복사 한 후 PHP 장인 덤프 - 자동로드를 수행하려고했지만 여전히 작동하지 않습니다
'Class acme\repositories\Video not found'
. 어떤 도움을 주셔서 감사합니다.
이름과 네임 스페이스 plz를 포함하여 Video 클래스 파일의 헤드를 표시합니다. 정확한 오류 메시지도 표시하십시오. – ToBe
위의 편집을 참조하십시오. –