我的代码中有几个地方会导致错误。 通常是
在/var/www/myappname/app/Http/Controllers/PerceptsController.php:1298上调用null上的成员函数functionDefined_in_Model())
在代码中我有这个:
public function report_on_entity($id, $pivoted = 'alpha') {
$object = Entity::find($id);
$standpoints = $object->functionDefined_in_Model()->paginate(10);
此代码生成Call to a member function functionDefined_in_Model() on null
,据我所知,这是不可能的,因为URL仅由现有的实体模型定义。
是否可以通过我的用户点击的网址获得错误反馈?
答案 0 :(得分:0)
我做了一个聪明的解决方案并得到了我想要的东西:
if(!$object) {
$error_at_URL = url()->current();
Mail::raw($message, function ($message_content) use ($id, $error_at_URL) {
$message_content->to('youremail@domain.com');
$message_content->subject('Error triggered by Entity id '.$id.' at this url: '.$error_at_URL. ". ");
});
}
当然我可以将响应存储在DB中,但上面的技巧可以完成这项工作。