フォームへの確認画面の流れとしては、一度確認画面にpostする値を経由してmysqlにinsertします。
大まかな流れは以下の通り。
(1)web/views/*.blade.php でフォーム入力
(2)routes/web.php で確認画面(ConfirmController)へpostする
(3)確認画面のControllerで、確認画面の.blade.php に値を渡す
(4)確認画面から route, controller, model 経由でinsertする
ブレイクダウンして順を追ってみていきましょう。

(1)web/views/*.blade.php でフォーム入力
companyindex.blade.php
「会社名」「代理店」がinput formです。formのactionは action=”/company/confirm” として確認画面に飛ばします。
<form action="/company/confirm" method="post" id="form1">
<table id="tbl">
@csrf
<tr>
<th>会社名</th><td><input type="text" name="company_name" size="40" value=""></td>
</tr>
<tr>
<th>代理店</th><td><input type="text" name="agent_name" size="40" value=""></td>
</tr>
</table>
<div class="button_wrapper remodal-bg">
<button type="submit" value="送信" id="square_btn" onClick="location.href='#modal'">登録</button>
</div>
</form>
(2)routes/web.php で確認画面(ConfirmController)へpostする
formの入力画面は get、確認画面 confirm へと入力完了は post
Route::get('/company/input', 'CompanyInputController@input');
Route::post('/company/confirm', 'CompanyConfirmController@confirm');
Route::post('/company/index', 'CompanyIndexController@index');
(3)確認画面のControllerで、確認画面の.blade.php に値を渡す
わたってきた値を $request->all()で変数に代入して、confirmに渡します。
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Company;
use App\Agent_mst;
class CompanyConfirmController extends Controller
{
public function confirm(Request $request){
$confirm = new Company($request->all());
return view('companyconfirm', compact('confirm'));
}
}
(4)確認画面から route, controller, model 経由でinsertする
conmapnyconfirm.blade.php
hiddenで渡さないと駄目ですね。
<form action="/company/index" method="post" id="form1">
<table id="tbl">
@csrf
<tr>
<th>会社名</th><td>{{$confirm->company_name}}</td>
</tr>
<tr>
<th>代理店</th><td>{{$confirm->agent_name}}</td>
</tr>
</table>
<div class="button_wrapper remodal-bg">
<button type="submit" value="送信" id="square_btn" onClick="location.href='#modal'">登録</button>
</div>
<input type="hidden" name="company_name" value="{{$confirm->company_name}}">
<input type="hidden" name="agent_name" value="{{$confirm->agent_name}}">
</form>
(4)確認画面から route, controller, model 経由でinsertする
これで、mysql側に入っているか確認します。
簡単やないかー
