检查用户是否已经在 laravel 4.2 中点击了提交按钮

check if the user had click the submit button already in laravel 4.2

在我的 blade 中,我有 blade 提供的提交按钮,这是我的代码

 {{ Form::submit('Create System User', array('class' => 'btn btn-primary')) }}

我想知道用户是否已经点击了提交按钮,因为我下面有一段代码说

  @if ($errors->any())
    <ul>
        {{ implode('', $errors->all('<p style="color:red" class="error">:message</p>')) }}
    </ul>
    @else
      <script>
          BootstrapDialog.alert('Record Added!');
      </script>
@endif

我的问题是它在加载时一直显示 bootstrap 警报,而它应该只在用户成功创建任何想法时显示?

按照这些思路应该可以解决问题:

在你的控制器方法中:

public function store()
{
    $input = Input::all();

    Session::flash('submitted', true);

    // Logic to create user

    return Redirect::back(); // Or whatever your response is
}

然后在你看来:

@if (Session::get('submitted'))
    <script>
        BootstrapDialog.alert('Record Added!');
    </script>
@endif