I been stuck on this problem for a day now.
Been passing data to views like this:
return view('email') -> with ('name', $results);
This is what $results looks like:
array:2 [▼
0 => {#204 ▶}
1 => {#205 ▼
+"Field": "Art Education"
+"Authors": "Genos"
+"Title": "Modern Art"
+"Date": "2015"
+"Adviser": "Saitama"
+"Language": "English"
+"Subject": "Test Case"
}
]
The view then receives it like this:
@foreach ($name as $name)
//
@endforeach
This works great, but now im working with Mailgun.
And this is how $results must be passed
Mail::send('email', $results, function($message) {
$message->to('[email protected]', 'Your Friendly Neighborhood Spiderman')->subject('Your Cart');
});
The main difference is in mailgun, I cannot use the with ('name', $results)
clause in the second argument so I am stuck with an associative array where each key is an iterating number (example: 1, 2, 3... etc.)
Is there any way for me to iterate through $results in blade with @foreach if its keys were numbers?
Apparently I can no longer work with @foreach ($name as $name)
Thanks!
It works for me
$data['results'] = $results;
Mail::send('email', $data, function($message) {
$message->to('[email protected]', 'Your Friendly Neighborhood Spiderman')->subject('Your Cart');
});
and in mail.blade.php i can iterate
@foreach ($results as $name)