Xetaravel-Mentions icon indicating copy to clipboard operation
Xetaravel-Mentions copied to clipboard

Call to undefined method App\\Models\\ProjectBriefComment::mention()

Open precamp-io opened this issue 2 years ago • 1 comments

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?

precamp-io avatar Nov 11 '22 20:11 precamp-io

I have also tried using a custom parser let me know if you need see and example of that

precamp-io avatar Nov 11 '22 20:11 precamp-io

Hey, You need to add HasMentionTrait to your model as mentionned in the readme.

Xety avatar Jan 04 '23 15:01 Xety