LoginSignup
mar-gitacount
@mar-gitacount (mar mar)

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Laravelのコントローラの処理が実行されない

解決したいこと

ブレードファイルのボタンをクリックしたら「get」でコントローラを呼び出しし自作した関数を実行したい

ルーティング

Route::resource('update', UpdateController::class);

コントローラ

public function index()
    {
       //
       Roundomjsonchoice::roundomserch();
       return redirect("/");
    }

ブレードファイル

<form method="get" action="{{ route('update.index')}}">
       @csrf
       <input type="submit" class="btn btn-primary" value="本日の北斎を更新する。">
</form>

発生している問題・エラー

上記のコードでボタンを押下するも、コントローラが実行されません。
とりあえずコントローラの処理を実行できればどうでもいいのでgetだろうがpostだろうがなんでもいいと思い
formでボタンクリックしたら実行する処理を書きましたが、urlをgetでクエリを渡して後は何も動きません。
コントローラまで処理がいかないのです。
何か原因が考えられる原因がありましたらご教授頂ければ幸いです。

0

1Answer

Comments

  1. @mar-gitacount

    Questioner
    コントローラ側でreturn redirect("/")しているのですが、処理実行時にページがトップに遷移しないため、コントローラまで処理が走ってないのかなと、、
    処理がコントローラまでいって何かしらの原因で動かないとも考えられますが、、
  2. 一旦return redirectをコメントし、dd(request()->all());とかで確認してください。

Your answer might help someone💌