Reputation: 103
i want to send an email when a candidate applies for a jobpost on my site to the candidate. my email controller
public function sendEmail(candidate $candidate, jobPost $jobPost){
$company= $jobPost->Company;
$name= $candidate->name;
$email= $candidate->email;
$job= $jobPost->title;
$data= [
'title'=>$company,
'content'=>'this is sent by hrlead',
];
Mail::send('email.test',$data,function ($message){
$message->to('[email protected]', 'vahid')->subject('hello vahid');
});
return back();
}
my route: Route::get('/email/{candidate}/{jobpost}', 'EmailsController@sendEmail');
i have an apply method which i want it to call the rout for it to send the email. but since i dont know how to return a dynamic url i am lost. so far at the end of my apply method i have put:
return `redirect`('/email/' + $candidate +'/'+$jobpost);
which wont work
now i dont know how to call the
Upvotes: 0
Views: 273
Reputation: 198
One simple way is that you can extend your Email Controller from the other controller, then you can access all the functions of your Email controller.
OtherController : EmailController
Also
OtherController extends EmailController
Upvotes: 1