Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BroadcastEvents calls non-static method trashed statically #37601

Closed
ejunker opened this issue Jun 4, 2021 · 2 comments · Fixed by #37618
Closed

BroadcastEvents calls non-static method trashed statically #37601

ejunker opened this issue Jun 4, 2021 · 2 comments · Fixed by #37618
Assignees
Labels

Comments

@ejunker
Copy link
Contributor

ejunker commented Jun 4, 2021

  • Laravel Version: 8.45.1
  • PHP Version: 8.0.6
  • Database Driver & Version: MySQL 5.7

Description:

I have a base Model class where I added: use BroadcastsEvents;

I get this error:

Non-static method App\Models\Campaign::trashed() cannot be called statically

Which makes sense because in Illuminate\Database\Eloquent\SoftDeletes it defines the trashed() method as:
public function trashed() but in BroadcastEvents it calls it like this:

static::trashed(function ($model) {
    $model->broadcastTrashed();
});

Steps To Reproduce:

  • add use BroadcastsEvents; to a model that also has use SoftDeletes;
  • try to persist an instance of the model

Update: while there is a "restored" model event, there doesn't appear to be a "trashed" model event.

@driesvints
Copy link
Member

From: #37491

@themsaid
Copy link
Member

themsaid commented Jun 7, 2021

fixed in #37618

@themsaid themsaid closed this as completed Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants