Closed ahmadmukhtarpl closed 4 years ago
Hi @ahmadmukhtarpl ,
Considering your situation, it might be unsuitable to extend your custom 'Message' model with the package's Message model. Same case goes to traits.
One option I can see working is creating a custom function in your 'helpers.php' class, say getMessageAttachments()
and call is like so in your blade or controller:
$attachments = getMessageAttachments($message);
function getMessageAttachments(Message $message)
{
$attachments = Attachment::where('message_id', $message->id);
// you can add filters here e.g. check if a user is allowed to view the file and such.
// So you need to update your function signature accordingly
return $attachments->get();
}
Let me know how that goes.
I'm using your package for chat in LARAVEL 6. Now I want to extend the functionality of this package by allowing the upload of attachments, one message can have multiple attachments. To achieve this I need to override your Message Model so I can define the relationships to the attachment model. How can I do that without editing the vendor file?