0
Speak next guys I have a problem sending form in this website
I am unable to send from an error that I do not know what is follows part of my codes with the log
error:
Controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Mail;
class HomeController extends Controller
{
public function contactPost(Request $request) {
//$data = $request->only('name', 'email', 'phone');
//$data['messageLines'] = explode("\n", $request->get('message'));
$data = $request->all();
Mail::send('emails.contact', $data, function ($message) use ($data) {
$message->subject('Novo Contato: '.$data['name'])
->to('[email protected]')
//->to('[email protected]')
->bcc('[email protected]')
->replyTo($data['email']);
});
return back()->withSuccess("Sua mensagem foi enviada.");
}
}
route:
Route::post('contact',[
'as' => 'contact',
'middleware' => ['lang', 'web'],
'uses' => 'HomeController@contactPost'
]);
Form:
<div class="row">
<div class="col-md-12 col-xs-12">
@if (session('success'))
<div class="alert alert-success">
{{ session('success') }}
</div>
@endif
{!! trans('contact.text') !!}
{!! Form::open(['url' => route('contact'), 'id' => 'contact-form', 'class' => 'uk-form']) !!}
<div class="row">
<div class="col-md-6">
{!! Form::text('name', null, ['placeholder' => trans('contact.name'), 'class' => 'form-control']) !!}
{!! Form::text('birthday', null, ['placeholder' => trans('contact.birthday'), 'class' => 'form-control']) !!}
{!! Form::text('country', null, ['placeholder' => trans('contact.country'), 'class' => 'form-control']) !!}
{!! Form::text('marital', null, ['placeholder' => trans('contact.marital'), 'class' => 'form-control']) !!}
{!! Form::text('phone', null, ['placeholder' => trans('contact.phone'), 'class' => 'form-control']) !!}
{!! Form::email('email', null, ['placeholder' => trans('contact.email'), 'class' => 'form-control']) !!}
{!! Form::textarea('previous_qualifications', null, ['placeholder' => trans('contact.previous_qualifications'), 'class' => 'form-control']) !!}
{!! Form::textarea('which_work', null, ['placeholder' => trans('contact.which_work'), 'class' => 'form-control']) !!}
{!! Form::text('courses', null, ['placeholder' => trans('contact.courses'), 'class' => 'form-control']) !!}
{!! Form::text('how_long', null, ['placeholder' => trans('contact.how_long'), 'class' => 'form-control']) !!}
{!! Form::text('wich_city', null, ['placeholder' => trans('contact.wich_city'), 'class' => 'form-control']) !!}
{!! Form::text('visa', null, ['placeholder' => trans('contact.visa'), 'class' => 'form-control']) !!}
</div>
<div class="col-md-6">
{!! Form::text('given_names', null, ['placeholder' => trans('contact.given_names'), 'class' => 'form-control']) !!}
<label for="passport">{!! trans('contact.passport') !!}</label>
{!! Form::select('passport', [
'Não' => trans('contact.include-children-option-no'),
'Sim' => trans('contact.include-children-option-yes')
], null, ['class' => 'form-control']) !!}
{!! Form::text('where_is', null, ['placeholder' => trans('contact.where_is'), 'class' => 'form-control']) !!}
<label for="kids">{!! trans('contact.kids') !!}</label>
{!! Form::select('kids', [
'Não' => trans('contact.include-kids-option-no'),
'Sim' => trans('contact.include-kids-option-yes')
], null, ['class' => 'form-control']) !!}
<label for="married">{!! trans('contact.married') !!}</label>
{!! Form::select('married', [
'Não' => trans('contact.include-married-option-no'),
'Sim' => trans('contact.include-married-option-yes')
], null, ['class' => 'form-control']) !!}
<label for="english">{!! trans('contact.english') !!}</label>
{!! Form::select('english', [
'Básico' => trans('contact.include-english-option-ba'),
'Intermediário' => trans('contact.include-english-option-in')
], null, ['class' => 'form-control']) !!}
<label for="exams">{!! trans('contact.exams') !!}</label>
{!! Form::select('exams', [
'Não' => trans('contact.include-exams-option-no'),
'Sim' => trans('contact.include-exams-option-yes')
], null, ['class' => 'form-control']) !!}
<label for="considered">{!! trans('contact.considered') !!}</label>
{!! Form::text('considered_text', null, ['placeholder' => trans('contact.considered_text'), 'class' => 'form-control']) !!}
<label for="intentions">{!! trans('contact.intentions') !!}</label>
{!! Form::select('intentions', [
'estudo' => trans('contact.include-intentions-option-study'),
'migração' => trans('contact.include-intentions-option-migration')
], null, ['class' => 'form-control']) !!}
<label for="know">{!! trans('contact.know') !!}</label>
{!! Form::select('know', [
'Brasil' => 'Facebook',
'Google' => 'Google',
'Indicação' => trans('contact.include-children-option-indication'),
'Outro' => trans('contact.include-children-option-other')
], null, ['class' => 'form-control']) !!}
{!! Form::submit(trans('contact.send'), ['class' => 'btn btn-primary send-button']) !!}
</div>
</div>
{!! Form::close() !!}
</div>
emails contact.:
<ul>
<li>Nome: <strong>{{ $name }}</strong></li>
<li>Nascimento: <strong>{{ $birthday }}</strong></li>
<li>País de nascimento: <strong>{{ $country }}</strong></li>
<li>Estado Civil: <strong>{{ $marital }}</strong></li>
<li>Telefone: <strong>{{ $phone }}</strong></li>
<li>Email: <strong>{{ $email }}</strong></li>
<li>Qualificações anteriores: <strong>{{ $previous_qualifications }}</strong></li>
<li>Experiência de trabalho relevante: <strong>{{ $which_work }}</strong></li>
<li>Cursos de escolha e período: <strong>{{ $courses }}</strong></li>
<li>Quanto tempo você pretende ficar na Austrália: <strong>{{ $how_long }}</strong></li>
<li>Em que cidade você gostaria de viver? porque?: <strong>{{ $wich_city }}</strong></li>
<li>Quando você gostaria de aplicar para o visto?: <strong>{{ $visa }}</strong></li>
<li>Nomes dados: <strong>{{ $given_names }}</strong></li>
<li>Tem passaporte de mais algum outro país, sem ser o brasileiro?: <strong>{{ $passport }}</strong></li>
<li>De onde é?: <strong>{{ $where_is }}</strong></li>
<li>Tem filhos?: <strong>{{ $kids }}</strong></li>
<li>Se você é casado e tem filhos, você pretende incluí-los na sua aplicação?: <strong>{{ $married }}</strong></li>
<li>Nível de inglês: <strong>{{ $english }}</strong></li>
<li>Você já fez algum exame de inglês?: <strong>{{ $exams }}</strong></li>
<li>É considerado na Austrália? Se sim, explique porque um e o resultado: <strong>{{ $considered }}</strong></li>
<li>Quais são suas intenções na Austrália?: <strong>{{ $intentions }}</strong></li>
<li>Como você soube sobre nós?: <strong>{{ $know }}</strong></li>
</ul>
LOG with the last 3 errors:
#97 /home/front/public_html/apstudentslaravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#98 /home/front/public_html/apstudents/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#99 {main}
NOTE: The error occurs when you fill in the form and send.
Where exactly does it give this error? this log does not bring clear information
– novic
As soon as you fill in the form and send it from the error
– Felipe Henrique
Put the error that is presented in
debug
of Laravel. please– novic