i have a small problem. When i am sending a contact information from my page i am receiving all the content of that page as a message. I have checked stackoverflow answers and i did everything like at larvel official web page. I figured out how to put the subject, sender email and name. I can't undersand how to make a view with text message. My code and routes looks like that:
Route::resource('contact-us', 'SendEmailController',['names'=>[
'store'=>'contact-us.store'
]]);
public function store(Request $request){
$subject =$request->subject;
$content = $request->body;
$email = $request->email;
$name = $request->name;
Mail::send('contact-us', ['email' => $email, 'name' => $name], function ($m) use ($email, $name) {
$m->from($email, $name);
$m->to('snaix93@gmail.com' , 'Alex')->subject('Your Reminder!');
});
the form from contact view
{!! Form::open(['method'=>'POST', 'action'=> 'SendEmailController@store']) !!}
<div class="form-group">
<label>Subject </label>
<input type="text" name="subject" class="form-control" >
</div>
<div class="form-group">
<label>Name </label>
<input type="text" name="name" class="form-control" >
</div>
<div class="form-group">
<label>Email *</label>
<input type="email" name="email" class="form-control" required="required">
</div>
<div class="form-group">
{!! Form::label('body', 'Message:') !!}
{!! Form::textarea('body', null, ['class'=>'form-control','rows'=>3])!!}
</div>
<div class="form-group">
{!! Form::submit('Submit Message', ['class'=>'btn btn-primary']) !!}
</div>
{!! Form::close() !!}
via Alexandru Statnii