Can't access my model in Listener?

Posted 4 years ago by isaackearl

I am using Laravel 5.1

I have An event and a listener... the model is one of the properties of my event. I then want to access this property from my listener, so in my handle method on the listener I do

dd($event->post)  // the model is App\Post

but it doesn't show my App\Post it shows this:

ModelIdentifier {
  class: "App\Post"
  id: 1862
}

I'm guessing this is do to the Event Serializing the model... but I thought it was supposed to be unserialized on the other side... regardless I can't use the post for anything useful on the other end unelss I want to use the ID to query the database again (which I don't want to do)...

What am I doing wrong here..

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.