php - How to load models in Laravel? -
i started studying laravel , ran problem using models. how load them? example in codeigniter used $model = $this->load->model('some_model')
. in laravel when call controller sites::ofuser()
work fine, when call sites::getid()
says method should static... possible call method without static or need create facades each model?
my model looks this:
namespace models; use eloquent; class sites extends eloquent { public function scopeofuser($query) {} public function getid($name) {} }
for static method--
$type = sites ::scopeofuser($query);
and if want normal codeingiter use--
$model = new sites ();
$type = $model->scopeofuser($query);
Comments
Post a Comment