I am making my own package.
I simplified the code to explain the weird error. I have a simple method inside a simple controller. First, i am sending an email (printing in laravel.log) and works fine.
public function signup(){
Mail::send('vendor.proto.register.emails.proto-register-new-account', [], function ($m) {
$m->from('noreply@test.com', 'Hello');
$m->to('sfs@dgf.c', 'pepe')->subject('Test. Congratulations, your account was created');
});
return view('view path');
}
But when i want to move the Mail:: to a private method like this.
public function signup(){
$this->sendNotification2();
return view('view path');
}
public function sendNotification2(){
Mail::send('vendor.proto.register.emails.proto-register-new-account', [], function ($m) {
$m->from('noreply@test.com', 'Hello');
$m->to('sfs@dgf.c', 'pepe')->subject('Test. Congratulations, your account was created');
});
}
It crash an print the error
FatalErrorException in ClassLoader.php line 373:
Maximum function nesting level of '100' reached, aborting!
Is it a bug? or i am doing something wrong ?
Solution.
Googling i found this solution. Notice i am using laravel 5.2 and php 5.6.7
Add in bootstrap\autoload.php
this code ini_set('xdebug.max_nesting_level', 200);
and it fix the problem.