jeudi 21 novembre 2019

How to change laravel notification user model receiver?

We have an API which connects to our own first party applications. Our API is sending out notifications based on user actions or if there is an update to the application etc.

Example

Our user model in API is located in App\Modules\Accounts\Models\User. Each month we send an invoice database notification to user from our API. In database it adds the notification and the notifiable_type is App\Modules\Accounts\Models\User.

enter image description here

But in our user application the user model is located in App\Modules\User which results user having 0 notifications.

Question

I know I can move the user model to exactly the same path in the user application but it seems somewhat wrong. Is there a way to tell the user model in our user application where to receive database notification on? Something like:

public function(){
    return $this->receivesNotificationsFrom('App\Modules\Accounts\Models\User');
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire