Почему я получаю сообщение «Нестатический метод не должен вызываться статически» при вызове метода в модели Eloquent? ⇐ Php
-
Anonymous
Почему я получаю сообщение «Нестатический метод не должен вызываться статически» при вызове метода в модели Eloquent?
I tried to load my model in my controller and tried this:
return Post::getAll(); and I still get the error
Non-static method Post::getAll() should not be called statically, assuming $this from incompatible context The function in the model looks like this:
public function getAll() { return $posts = $this->all()->take(2)->get() } What's the correct way to load the model in a controller and then return its contents?
Источник: https://stackoverflow.com/questions/183 ... en-invokin
I tried to load my model in my controller and tried this:
return Post::getAll(); and I still get the error
Non-static method Post::getAll() should not be called statically, assuming $this from incompatible context The function in the model looks like this:
public function getAll() { return $posts = $this->all()->take(2)->get() } What's the correct way to load the model in a controller and then return its contents?
Источник: https://stackoverflow.com/questions/183 ... en-invokin
Мобильная версия