Skip to content

Using BroadcastsEvents with a landlord model #566

Answered by IronSinew
IronSinew asked this question in Q&A
Discussion options

You must be logged in to vote

I ended up doing this:

<?php

namespace App\Services\Tenancy;

use Illuminate\Database\Eloquent\BroadcastableModelEventOccurred;
use Spatie\Multitenancy\Jobs\NotTenantAware;

class LandlordBroadcastableModelEvents extends BroadcastableModelEventOccurred implements NotTenantAware {}

Any landlord model that needs to broadcast:

    protected function newBroadcastableEvent(string $event): BroadcastableModelEventOccurred
    {
        return new LandlordBroadcastableModelEvents(
            $this, $event
        );
    }

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by IronSinew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant