Hi Awesome People
I'm very new to Laravel, i'm trying to send mail from a contact page but i'm getting the following error
FatalErrorException in ClassLoader.php line 347:
Maximum function nesting level of '100' reached, aborting!
And i did gone through the following discussion
https://laracasts.com/discuss/channels/general-discussion/l5-maximum-function-nesting-level-of-100-reached-aborting
but they all say about something called "Xdebug" and incrementing "Level" which i don't know how to do. "i'm using WAMP for developing" once every thing works i got to deploy the project in godaddy hosting
Let me tell you what i did exactly
I have created a contact page where user fill the form and submit the form "contact.blade.php"
<form method="POST" action="contact" id="contact_form" class="contact-form custm-form"
role="form" enctype="multipart/form-data">
{!! csrf_field() !!}
<div class="row">
<div class="col-md-6">
<ul class="row">
<li class="col-sm-12">
<label>
<input type="text" class="form-control" name="name" id="name" placeholder="Your Name" required>
</label>
</li>
<li class="col-sm-12">
<label>
<input type="email" class="form-control" name="email" id="email" placeholder="E-Mail" required>
</label>
</li>
<li class="col-sm-12">
<label>
<input type="number" class="form-control" name="phone" id="phone" placeholder="Phone" required>
</label>
</li>
<li class="col-sm-12">
<label>
<input type="text" class="form-control" name="subject" id="subject" placeholder="Subject" required>
</label>
</li>
</ul>
</div>
<div class="col-md-6">
<ul class="row">
<li class="col-sm-12">
<label>
<textarea class="form-control" name="message" id="message" rows="5" placeholder="Your Message"></textarea>
</label>
</li>
<li class="col-sm-12">
<button type="submit" value="submit" class="btn" id="btn_submit">Send Message</button>
</li>
</ul>
</div>
</div>
</form>
And I created a Controller called "AvoContactController.php"
<?php
namespace App\Http\Controllers;
use View;
Use Mail;
use App\AvoContact;
use App\Http\Requests;
use App\Http\Requests\ContactFormRequest;
use Illuminate\Routing\Controller as BaseController;
class AvoContactController extends BaseController {
public function contactpage()
{
$contact = AvoContact::all();
return view('pages.contact')->with(['contact' => $contact]);
}
public function store(ContactFormRequest $request)
{
//this is the part throwing the error
Mail::send('emails.contact', [], function ($m) {
$m
->from($request->get('email'))
->to(env('CONTACT_MAIL'))
->subject('Your Reminder!');
});
return 'Email Sent';
}
}
And I created a Requestes/ContactFormRequest.php and set the "authrization to true"
The In the ".env" file
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=2525
MAIL_USERNAME=sanjiarya2112@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=null
CONTACT_MAIL=sanjiarya2112@gmail.com
And The Routes
Route::get('contact', 'AvoContactController@contactpage');
Route::post('contact', 'AvoContactController@store');
Every thing seems working fine, but when i fill the form and submit i'm getting that error
i'm really stuck i just couldn't figure out what the problem is..
Looking forward for much needed help
Thank You