Xetaravel-Mentions
Xetaravel-Mentions copied to clipboard
Call to undefined method App\\Models\\ProjectBriefComment::mention()
Hi
I have followed your setup instructions but may missed something. Why would I be getting this error when i am posting a comment to the controller. I don't see any reference of mention() method.
message: "Call to undefined method App\Models\ProjectBriefComment::mention()",…} exception: "BadMethodCallException" file: "C:\wamp64\www\precampDev6_v1\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php" line: 71 message: "Call to undefined method App\Models\ProjectBriefComment::mention()"
This is my code:
public function storebriefcommentreply(Request $request, $project_id)
{
$request->validate([
'body'=>'required',
'parent_id'=>'required',
]);
// dd($request);
$input = $request->all();
$input['user_id'] = auth()->user()->id;
$comment = ProjectBriefComment::create($input);
$parser = new \App\Parser\CustomParser($comment);
$parser = new MentionParser($comment);
$content = $parser->parse($comment->body);
$comment->body = $content;
$comment->save();
echo json_encode(true);
}
Can you help me please?
I have also tried using a custom parser let me know if you need see and example of that
Hey,
You need to add HasMentionTrait
to your model as mentionned in the readme.