I am getting NoMessages error while redirecting to a page.
add.blade.php
@extends('layout.app')
@section('content')
{!! Form::open(['action' => 'AddluggageController@addconfirm','method'=>'POST']) !!}
<div class="form-group row">
<div class="col-4">
<h5 class="col-12"><b> Passenger Info</b> </h5>
<div class="col-12">
{{form::label('name'), 'Name'}}
{{form::text('name','',['class'=>'form-control '])}} <br><br>
</div>
<div class="col-12">
{{form::label('phone'), 'Phone'}}
{{form::text('phone','',['class'=>'form-control '])}}
</div>
</div>
sni</div>
{!! Form::close() !!}
@endsection
AddluggageController.php
public function addconfirm(){
return redirect('/addsuccess')->with('success', 'Saved Successfully');
}
web.php
Route::post('/addconfirm', 'AddluggageController@addconfirm');
when I redirect it gives me
MethodNotAllowedHttpException
No message
According your comment you need to change route name to addluggage
from addsuccess
return redirect('/addluggage')->with('success', 'Saved Successfully');
Whenever you redirect it have get
not post
so change in controller where you redirect
public function addconfirm(){
return view('addconfirm')->with('success', 'Saved Successfully');
// here "addconfirm" is blade name as "addconfirm.blade.php" inside "resoruces/views" folder
}
You can also change from action
to url
{!! Form::open(['url' => '/addconfirm','method'=>'POST']) !!}
change your route method to GET
:Route::get('/addconfirm', 'AddluggageController@addconfirm');
then add following to your blade:
@if (\Session::has('success'))
{!! \Session::get('success') !!}
@endif