0
Laravel에서 제공하지 않는 몇 가지 일반적인 기능에 대해 사용하고있는 라이브러리 클래스를 만들었습니다. 'aliases'배열 아래 /config/app.php에로드되었으므로 문제가되지 않습니다.Laravel 4 - 맞춤 라이브러리 클래스에서 Eloquent 모델 사용
내 클래스 ("InfoParse")에서 메서드를 호출하면 사용자가 빈 페이지를 반환합니다. 이것은 Eloquent를 사용하여 데이터베이스와 인터페이스하는 라이브러리에서 메서드를 호출한다는 사실과 관련이 있다고 생각합니다. 나는 파일의 상단에
use Illuminate\Database\Eloquent\Model;
을 추가하려고 시도했지만 도움이되지 않았습니다.
DB : : 클래스 또는 Eloquent 클래스를 사용할 수 있도록 클래스 파일을 설정해야하는 구체적인 방법이 있습니까?
/**
* Check to see if this student is already recorded in our student table.
* If not, add the entry, then return true.
* @param int $cwid
* @return boolean
*/
public static function checkStudentTableRecords($cwid)
{
if(Student::where('cwid', '=', $cwid)->count() != 0)
{
return TRUE;
}
else
{ ##insert the student into our student table
$studentInfo = self::queryInfoFromCWID($cwid);
$studentEntry = new Student;
$studentEntry->cwid = $cwid;
$studentEntry->fName = $studentInfo['fName'];
$studentEntry->lName = $studentInfo['lName'];
$studentEntry->email = $studentInfo['email'];
$studentEntry->save();
return TRUE;
}
}
: 아래
문제의 함수이다 (참고 : 자기 :: queryInfoFromCWID() 함수는 클래스의 이전 정의 함수 호출입니다) 몇 가지 조사 후
실제로 처음에'\\''는'global/root' 네임 스페이스를 나타냅니다. –
나를 도와 줘서 고마워. – racl101