Laravel Polymorphic Relations Has Many Through

前端 未结 5 1737
闹比i
闹比i 2020-12-09 09:37

I have a Subscriber Model

// Subscriber Model

id
user_id
subscribable_id
subscribable_type

public function user()
{
    return $this->belongsTo(\'App\\U         


        
5条回答
  •  离开以前
    2020-12-09 10:03

    Ok, i got a better solution

    // Subscriber Model
    
    use Notifiable;
    
    public function receivesBroadcastNotificationsOn()
    {
        return 'App.User.' . $this->user_id;
    }
    
    
    // Send Notification
    
    Notification::send($post->subscribers, new TestNotification($post));
    

提交回复
热议问题