的get()我有这个在我的模型Scholar
如何启动模式不会对laravel
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Scholar extends Model {
protected $primaryKey = 'scholar_id';
protected $fillable = ['ngo_id','scholar_lname','scholar_fname','scholar_image','scholar_nickname','scholar_cityAddress','scholar_permaAddress','scholar_birthday','scholar_placebirth','scholar_age','scholar_gender','scholar_email','scholar_contact'];
}
,那么这是对我的控制器
$scholars = new Scholar; <------
if(Input::get('age_from'))
$scholars->where('age', '=', Input::get('age_from'));
$scholars->get();
return $scholars;
我要发起这个,但是当我尝试$scholars = Scholar::all();
我不能再使用->get()
;
无论如何如何做到这一点可选where
?
它返回我这个'非静态方法Illuminate \ Database \ Eloquent \ Model :: newQuery()不应该被静态调用,假设$ this来自不兼容的上下文' –
啊,道歉,更新 –