Я переопределяю метод create()
Eloquent, но при попытке вызвать его получаю Cannot make static method Illuminate\\Database\\Eloquent\\Model::create() non static in class MyModel
.
Я вызываю метод create()
следующим образом:
$f = new MyModel();
$f->create([
'post_type_id' => 1,
'to_user_id' => Input::get('toUser'),
'from_user_id' => 10,
'message' => Input::get('message')
]);
А в классе MyModel
у меня так:
public function create($data) {
if (!Namespace\Auth::isAuthed())
throw new Exception("You can not create a post as a guest.");
parent::create($data);
}
Почему это не работает? Что я должен изменить, чтобы заставить его работать?