Comments (2)
Problem solved. when extending class it should be import class from facade, not core class
instead of Chatify\ChatifyMessenger;
should import Chatify\Facades\ChatifyMessenger;
from chatify.
hey, i'm having the same problem, but it was not fixed with the replacement of the import.
I have the folloing in my Custom class:
<?php
namespace App\Http\Controllers\vendor\Chatify;
use Chatify\Facades\ChatifyMessenger;
use Illuminate\Support\Facades\Facade;
use App\Models\ChMessage as Message;
use App\Models\ChFavorite as Favorite;
use Illuminate\Support\Facades\Storage;
use Pusher\Pusher;
use Illuminate\Support\Facades\Auth;
use Exception;
class CustomChatify extends ChatifyMessenger
{
public $pusher;
public function parseMessage($prefetchedMessage = null, $id = null)
{
$msg = null;
$attachment = null;
$attachment_type = null;
$attachment_title = null;
if (!!$prefetchedMessage) {
$msg = $prefetchedMessage;
} else {
$msg = Message::where('id', $id)->first();
if(!$msg) {
return [];
}
}
if (isset($msg->attachment)) {
$attachmentOBJ = json_decode($msg->attachment);
$attachment = $attachmentOBJ->new_name;
$attachment_title = htmlentities(trim($attachmentOBJ->old_name), ENT_QUOTES, 'UTF-8');
$ext = pathinfo($attachment, PATHINFO_EXTENSION);
$attachment_type = in_array($ext, $this->getAllowedImages()) ? 'image' : 'file';
}
return [
'id' => $msg->id,
'from_id' => $msg->from_id,
'to_id' => $msg->to_id,
'class_id' => $msg->class_id,
'message' => $msg->body,
'attachment' => (object) [
'file' => $attachment,
'title' => $attachment_title,
'type' => $attachment_type
],
'timeAgo' => $msg->created_at->diffForHumans(),
'created_at' => $msg->created_at->toIso8601String(),
'isSender' => ($msg->from_id == Auth::user()->id),
'seen' => $msg->seen,
];
}
public function newMessage($data)
{
$message = new Message();
$message->from_id = $data['from_id'];
$message->to_id = $data['to_id'];
$message->class_id = $data['class_id'];
$message->body = $data['body'];
$message->attachment = $data['attachment'];
$message->save();
return $message;
}
}
and i get this error when i open a chat:
exception : "Error" file : "C:\\estudo\\4labs\\app\\Http\\Controllers\\vendor\\Chatify\\MessagesController.php" line : 226 message : "Non-static method App\\Http\\Controllers\\vendor\\Chatify\\CustomChatify::parseMessage() cannot be called statically"
I tryed to put hte entire ChatifyMessenger in the CustomChatify but then I get the same error for other classes.
How to fix this?
ps, i'm rying to create a group one directional chat for a teacher to send messages to a class of students.
from chatify.
Related Issues (20)
- errer in auth HOT 2
- The chat not update in real time HOT 7
- Generate MessageController instead of CustomMessage HOT 1
- Websocket not working HOT 1
- How to fetch user's avatar from database HOT 1
- Custom list of contacts HOT 2
- Unable to publish route files HOT 4
- Support for datatable user primary key different as id and using UUID HOT 1
- Can't authenticate my Customers user table HOT 1
- Images not showing, Filesystem, env, and storage checked HOT 1
- Using my own websocket server HOT 2
- Image preview shows but when image is uploaded it goes blank HOT 1
- Internal Server Error
- Your Image is not showing HOT 2
- The chat not update in real time HOT 8
- License HOT 4
- Chat messages wont update real time (solution disable debugbar) HOT 1
- Custom Messager Class : Non-static method error. HOT 2
- Not updating in Realtime neither are chats opening HOT 1
- only name showing not image HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatify.