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.
Feb 13, 2020
2
Level 12
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.
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.