project is laravel 5.6. My project has 2 routes:
web.php
Route::get('testa', 'HomeController@showTestForm')->name('test');
Route::post('testa', 'HomeController@doTest');
HomeController :
public function showTestForm()
{
Log::warning('from showTestForm');
return view('test');
}
.public function doTest(Request $request)
{
Log::info('from doTest');
// return Input::all();
return view('test', [
'input' => implode(', ', Input::all()),
]);
}
test.blade.php
<form method="post" action="{{ route('test') }}">
@csrf
<input type="text" name="inputvalue">
<button type="submit" class="btn btn-primary">
merge
</button>
</form>
<div>Result</div>
@if(isset($input))
{{$input}}
@endif
Why is working post on route('test') ? Thank you.
get
you'll trigger theRoute::get()
method. – AfikDeri