laravel-notification-channels/twitter

Driver [App\Notifications\TwitterChannel] not supported.

AzrizHaziq opened this issue · 2 comments

Hello, so i'm new and would like some inside from you guys.

This is my notification class

class NewPostPublished extends Notification
{
    use Queueable;

    public function via($notifiable)
    {
        return [TwitterChannel::class];
    }

    public function toTwitter($notifiable) {
        return new TwitterStatusUpdate('Laravel notifications are awesome!');
    }

}

This one, is controller

class TwitterController extends Controller
{
    public function updateStatus(Request $request){
      User::find(1)->first()->notify(new NewPostPublished($lala));
    }
}

Config\App.php already inserted and .env file also had been setup

Any idea what might wrong?

Error Output

InvalidArgumentException in Manager.php line 90:
Driver [App\Notifications\TwitterChannel] not supported.
in Manager.php line 90
at Manager->createDriver('App\Notifications\TwitterChannel') in ChannelManager.php line 230
at ChannelManager->createDriver('App\Notifications\TwitterChannel') in Manager.php line 63
at Manager->driver('App\Notifications\TwitterChannel') in ChannelManager.php line 79
at ChannelManager->sendNow(object(Collection), object(NewPostPublished)) in ChannelManager.php line 43
at ChannelManager->send(object(Collection), object(NewPostPublished)) in RoutesNotifications.php line 18
at User->notify(object(NewPostPublished)) in TwitterController.php line 13
at TwitterController->updateStatus(object(Request))
at call_user_func_array(array(object(TwitterController), 'updateStatus'), array(object(Request))) in Controller.php line 55
at Controller->callAction('updateStatus', array(object(Request))) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(TwitterController), 'updateStatus') in Route.php line 189
at Route->runController() in Route.php line 144
at Route->run(object(Request)) in Router.php line 642
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ThrottleRequests.php line 49
at ThrottleRequests->handle(object(Request), object(Closure), '60', '1') in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Router.php line 644
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 618
at Router->dispatchToRoute(object(Request)) in Router.php line 596
at Router->dispatch(object(Request)) in Kernel.php line 267
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 53
at require('/Applications/workdirectory/playground/public/index.php') in server.php line 106

Update: insert error message

Sorry, my bad

you need to include this on Notification Class

use NotificationChannels\Twitter\TwitterChannel;
use NotificationChannels\Twitter\TwitterMessage;

Hey @twinlight , glad you could figure it out yourself.