Pixelairport's avatar

Problem with bind and get the classes with app()

Hi. I binded two different classes (a helper and a repository) with providers. Now i create a job for queueing the send of emails. In the handle() method I try to get these binded classes. The strange thing is the first one works the second not:

    $this->mailerHelper = app('mailer.helper');

    $this->trackerevent = app('tracker.trackerevent');

When i do dd($this->trackerevent) I get the same as when i do dd(app()). The other thing works as expected ($this->mailerHelper). It is really strange and I hope someone has an idea.

0 likes
2 replies
Pixelairport's avatar

I tried it another was and now i got an output with "Serialization of 'Closure' is not allowed". Dont know how to get the binded repository. Have someone an idea? I wonder why $this->mailerHelper = app('mailer.helper'); is working and $this->trackerevent = app('tracker.trackerevent'); not.

Pixelairport's avatar
Pixelairport
OP
Best Answer
Level 12

Ok it works... when i do it with a closure.

public function handle(TrackereventRepository $tracker) { // ... }

thx

Please or to participate in this conversation.