Answer the question
In order to leave comments, you need to log in
Why doesn't @foreach work in laravel?
I want that after filling out the application on the site, the entered values will come to my mail.
In the controller, I indicated that, in $message, everything that the user entered will be recorded:
public function call(Request $request) {
$message = $request->All();
Mail::send('pages._partials.email', $message, function($message) {
$message->to('[email protected]', 'mail')->subject('Заявка с сайта');
});
return redirect()->route('pages.index');
}
@extends('layouts.master')
@section('content')
<h2>Заявка с сайта</h2>
@foreach ($message as $key => $value)
<p>{{ $key }} and {{ $value }}</p>
@endforeach
@stop
Answer the question
In order to leave comments, you need to log in
Mail::send('pages._partials.email', compact('message'), function($message) {
$message->to('[email protected]', 'mail')->subject('Заявка с сайта');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question