Почему я получаю сообщение «Нестатический метод не должен вызываться статически» при вызове метода в модели Eloquent? ⇐ Php
Почему я получаю сообщение «Нестатический метод не должен вызываться статически» при вызове метода в модели 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
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
PHP устарел: нестатический метод не следует вызывать статически [дубликат]
Anonymous » » в форуме Php - 0 Ответы
- 29 Просмотры
-
Последнее сообщение Anonymous
-
-
-
STM32F103C8T6 Остановите работу при вызове объекта Нестатический метод внутри ISR
Anonymous » » в форуме C++ - 0 Ответы
- 3 Просмотры
-
Последнее сообщение Anonymous
-