Hello everyone,
my form will submit a post to AbcController@updateTicket to process, it will go thought all $ticket->status.
my problem is $ticket->status "new" and "process" is working fine. but the last if else condition to using return back() function, it will be got the "No Message" error. I also found the session is empty.
I had no idea why the session will be empty when using return back()->with();
Please help me. Thanks so much! PS: my Laravel Version 5.6
Error Message
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
No message
protected function methodNotAllowed(array $others)
{
throw new MethodNotAllowedHttpException($others);
}
/**
* Get routes from the collection by method.
*
* @param string|null $method
* @return array
*/
public function get($method = null)
{
return is_null($method) ? $this->getRoutes() : Arr::get($this->routes, $method, []);
}
Arguments
1.""
Route
Route::post('/abc/updateTicket','AbcController@updateTicket')->name('abc.updateTicket');
View
@if ( Session::has('errors'))
<div class="alert alert-danger" align="center">
<p>{{ $errors }}</p>
</div>
@endif
<form class="form-inline" role="form" data-toggle="validator" name="search"
action="{{ route('abc.updateTicket') }}" method="post">
{!! csrf_field() !!}
@if (!empty($txtTicketNo))
<input type="text" class="form-control input-sm" id="txtTicketNo" name="txtTicketNo"
value="{{ $txtTicketNo }}">
@else
<input type="text" class="form-control input-sm" id="txtTicketNo" name="txtTicketNo">
@endif
<button class="btn btn-default btn-sm" type="submit" name="btnTicketNo">Enter</button>
</form>
Controller
if ($ticket-status === "new" ){
// do something
return view('abc.index', compact('ticket', 'txtTicketNo'));
} elseif ($ticket-status === "process" ){
// do somting
return view('abc.index', compact('ticket', 'txtTicketNo'));
}else{
return back()-with('error',' error message');
}