<?php namespace App\Http\Controllers;
useApp\Http\Requests;
useApp\Http\Controllers\Controllers;
use Illuminate\Http\Request;
use Illuminate\Contracts\Mail\Mailer;
use Illuminate\Mail\Message;
use Session;
class ContactController extensions Controller
{
/*
|--------------------------------------------------------------------------
| Welcome Controller
|--------------------------------------------------------------------------
|
| This controller is designed to create a marketing page for the application.
| Rendered and configured to appear only to guests.
| As with other controller samples, change or delete whatever you want.
|
*/
/**
* Creating a New Controller Instance
*/
public function__construct()
{
#$this->middleware('guest');
}
/**
* Show application welcome page to user
* Non-login TOP Page
* @parambool | false$open
* @return$this
*/
/**
* Contact Us Form
*/
public function getIndex(Request$request)
{
// $test = Session::get('set_category');
$test1 = Session::get('set_category1');
$test2 = $request->session()->get('set_category2');
return view('contact.index');
}
/**
* confirmation process
*/
public function postConfirm(Request$request)
{
$this->validate($request,[
'locations' = > 'required',
'situation' = > 'required',
'generation' = > 'required',
'name' = > 'required',
'prefectures' = > 'required',
'movein' = > 'required',
'tel' = > 'required | numeric',
'return' = > 'required',
'time' = > 'required',
]);
\Session::flash("request", $request->all());
return redirect('contact/confirm');
}
/**
* confirmation page
*/
public function getConfirm()
{
if(!\Session::has('request')){
return redirect('contact');
}
$request=\Session::get('request');
\Session::keep(['request']);
return view('contact.confirm',$request);
}
/**
* mail transmission processing
* Todo:add mail destination to settings
*/
public function postSend(Request$request)
{
$this->validate($request,[
'locations' = > 'required',
'situation' = > 'required',
'generation' = > 'required',
'generation' = > 'required',
'name' = > 'required',
'prefectures' = > 'required',
'movein' = > 'required',
'tel' = > 'required | numeric',
'return' = > 'required',
'time' = > 'required',
]);
$data = $request->all();
\Session::flash("request", $data);
\Mail::send('emails.contact', $data, function($message)use($data)
{
$message->from($data['email'], $data['name']);
$message->to('sample@〇 ..jp', ' 〇 サポート Support Center') ->subject('[]Contact Us Form');
});
return redirect('contact/send');
}
/**
* Submission Completion Page
*/
public function getSend()
{
return view('contact.send');
}
}
After completing the form, the email will not be sent even if you submit it.
Do you know why?
This is the controller for the above form.
laravel
Are there any errors?
In my case,
FatalErrorException in ClassLoader.phpline344:
Maximum function nesting level of '100' reached, aborting!
Failed to send due to the occurrence of .
ini_set('xdebug.max_nesting_level',200);
\Mail::send(...)
is now able to send emails without errors.
I hope it will be helpful.
© 2024 OneMinuteCode. All rights reserved.