$this->sendGrid = new SendGrid(config('services.sendgrid.key')); } public function saveUser(User $user): void { // コンタクトリストへの追加処理 } public function sendMail(Mail $mail): void { // メール送信処理 } }
new SettingA(); $settingB = new SettingB(); $settingC = new SettingC(); $settingD = new SettingD(); $someService = new SomeService($settingA, $settingB, $settingC, $settingD);
$this->app->bind('sendgrid', function ($app) { $sendGrid = new SendGrid(config('services.sendgrid.user.key')); return new SendGridService($sendGrid); }); } }
$this->app->bind('sendgrid', function ($app) { $sendGrid = new SendGrid(config('services.sendgrid.user.key')); return new SendGridService($sendGrid); }); } } key
$this->app->bind('sendgrid', function ($app) { $sendGrid = new SendGrid(config('services.sendgrid.user.key')); return new SendGridService($sendGrid); }); } } key value