I have setup a Route
:
Route::resource('conferences', 'ConferencesController)
Artisan
therefore shows me a route:
POST conferences | conferences.store | ConferencesController@store
When I submit a Form
from the create
View, I get the error that a variable in my layout file has not been defined.
Undefined variable: content
is shown, nothing has been posted.
I opened my form like this:
{{ Form::open(array('url' => '/conferences', 'class' => 'conference-form')) }}
And finally, my store
method in ConferencesController
looks like this:
public function store()
{
$validator = Validator::make(Input::all(), Conference::$rules);
if($validator->passes()){
$conference = new Conference();
$conference->title = Input::get('title');
$conference->description = Input::get('description');
$conference->location = Input::get('location');
$conference->plannedTime = Input::get('plannedTime');
$conference->save();
Mail::pretend();
Mail::send('emails.conference.create', ['title' => Input::get('title'), 'location' => Input::get('location'), 'plannedTime' => Input::get('plannedTime')], function($message){
$message->to('email')->subject('Een nieuw evenement is gemaakt.');
});
Redirect::to('/conferences')->with('message', 'Nieuw event is aangemaakt!');
} else {
Redirect::to('/')->with('message', 'Iets ging mis');
}
}
How do I fix this error?
** EDIT: Added create method **
public function create(){
$this->layout->content = View::make('conferences.create');
}