的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來自不兼容的上下文' –
啊,道歉,更新 –