0

Suppose I design an email template notifying about the interview scheduled for 3 candidates to a recruiter, so in that case I send candidates array of 3 elements as a variable to my template. How do I access individual candidates name in that case?

1
  • You can enqueue a job + pass array of three candidates. Then within the job query each candidate and with foreach loop send email to each of them. So you pass only one candidate name to each email. Commented Dec 3, 2018 at 13:09

1 Answer 1

1

you only need to pass parameters as you would for any other, with

$candArr = Candidates::where('something','value')->get();
return view('email')->with('candidates',$candArr);

Or

$candArr = Candidates::where('something','value')->get();
return view('email',compact('candArr'));

and then in view

@foreach($candArr as $key)
 {{$key->name}}
@endforeach

Hope it helps!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.