RTippin / messenger

Laravel messenger. A full messenger suite for your new / existing laravel app! Private and group threads between multiple models, with real-time messaging, reactions, attachments, calling, chat bots, and more!
https://tippindev.com
MIT License
416 stars 84 forks source link

The given provider { App\Models\User } must implement the interface RTippin\Messenger\Contracts\MessengerProvider #49

Closed tapang786 closed 2 years ago

tapang786 commented 2 years ago

This is my USER Model ---

use Illuminate\Database\Eloquent\Builder; use RTippin\Messenger\Contracts\MessengerProvider; use RTippin\Messenger\Traits\Messageable;

use Illuminate\Notifications\Notifiable; use Laravel\Passport\HasApiTokens;

class User extends Authenticatable implements MessengerProvider {
//Default trait to satisfy MessengerProvider interface use SoftDeletes, Notifiable, HasApiTokens, Messageable;

Error When run command -- php artisan serve or run any command

InvalidArgumentException

The given provider { App\Models\User } must implement the interface RTippin\Messenger\Contracts\MessengerProvider

at vendor/rtippin/messenger/src/Messenger.php:92 88▕ } 89▕ 90▕ foreach ($providers as $provider) { 91▕ if (! is_subclass_of($provider, MessengerProvider::class)) { ➜ 92▕ throw new InvalidArgumentException("The given provider { $provider } must implement the interface ".MessengerProvider::class); 93▕ } 94▕ 95▕ $this->providers[$provider] = new MessengerProviderDTO($provider); 96▕ }

  +1 vendor frames 

2 app/Providers/MessengerServiceProvider.php:28 Illuminate\Support\Facades\Facade::__callStatic("registerProviders")

RTippin commented 2 years ago

@tapang786 can you share your entire user model please? Also, please surround in a code block, otherwise it is hard to read.

You did not by chance overwrite any of my interfaces methods did you? From: https://github.com/RTippin/messenger/blob/1.x/src/Contracts/MessengerProvider.php

Please be sure your user model defines every method exactly as the interface expects, which my trait https://github.com/RTippin/messenger/blob/1.x/src/Traits/Messageable.php does by default, but I see you use my trait, so I wonder if you are overwriting anything method wise.

tapang786 commented 2 years ago

Thanks for replay my issue is solved now Thanks for your support @RTippin