I am having an issue regarding post route in laravel. Everytime i try to post data into my model, I get a 419 error i.e my session has been expired. What would be the solution to this problem?
public function store(Request $request)
{
$this->validate($request, [
'title' => 'required',
'body' => 'required',
]);
$post = new Post;
$post->title = $request->input('title');
$post->body = $request->input('body');
$post->save();
return redirect('/posts')->with('success', 'Post created');
}
Following is the blade code
{!! Form::open(['action' => 'postsController@store', 'method' => 'POST']) !!}
<div class='form-group'>
{{ Form::label('title','Title') }}
{{ Form::text('title','',['class'=>'form-control','placeholder'=>'Title']) }}
</div>
<div class='form-group'>
{{ Form::label('body','Body') }}
{{ Form::textarea('body','',['id'=>'article-ckeditor','class'=>'form-control','placeholder'=>'Body Text']) }}
</div>
{{ Form::submit('Submit',['class'=>'btn btn-primary']) }}
{!! Form::close() !!}