I am a new laravel. I try to create category into the database but i meet the problem of TokenMismatchException in VerifyCsrfToken.php line 67:. After meet this problem i try to add into my form but it got the same error. Please help me to solve this problem. Thanks
View Form
{!! Form::open(array('action' => ['Page_Admin@updatemaincate', $main_cate->id], 'method' => 'PUT', 'enctype' => 'multipart/form-date')); !!}
<div class="modal-header" style="background:#3C8DBC;">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title" style="color:#fff;">New Main-Category</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
{!! Form::label('title', 'Title'); !!}
{!! Form::text('title', $value = $main_cate->title, $attributes = ['class' => 'form-control', 'name' => 'title']); !!}
</div>
</div>
</div> <!--end 12-->
</div> <!--end row-->
</div>
<div class="modal-footer custom-default">
{!! Form::submit('Edit', $attributes = ['class' => 'btn btn-default']) !!}
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
</div>
{!! Form::close(); !!}
Controller
public function maincategories()
{
$maincategory = maincategory::all();
return view('admin/maincategories', compact('maincategory'));
}
public function setmaincate(Request $request){
$this->validate($request,[
'title' => 'required'
]);
$tbl_maincate = new maincategory;
$tbl_maincate->title = Input::get('title');
$tbl_maincate->save();
Session::flash('success', 'Adding multiple images are successfully');
return Redirect('/maincategories');
}
Route
Route::get('/', 'Page_Admin@index');
Route::resource('admin', 'Page_Admin');
Route::get('maincategories', 'Page_Admin@maincategories');
Route::post('setmaincate', 'Page_Admin@setmaincate');
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2qtkO4j
via IFTTT
Aucun commentaire:
Enregistrer un commentaire