2017-10-22 21:47



I'm having troubles to just redirect to a url from a controller.

This is my trigger:

<form method="POST" action="{{ url('creategroup") }}">

Then, this is the catcher:

Route::post('/creategroup', 'GroupController@store');

And finally, this is my method:

public function store(Request $request) {
    /* bla bla bla */
    return Redirect::to('/users/'.$request->id.'/groups/');

But it doesn't work, the url just stops in localhost/creategroup and it shows a page that say that the page has expired, and it doesn't redirect to any place. Help please.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • douyu0725 douyu0725 4年前

    Looks like a problem with csrfToken.

    Have you added the field on the form?

    {!! csrf_field() !!}

    Learn more here

    点赞 评论 复制链接分享
  • douwen1549 douwen1549 4年前

    This could happen due to the first backslash, try following:

    return redirect('users/'.$request->id.'/groups');
    点赞 评论 复制链接分享