I have an index page that have subscriber form. when the user entered their email address, the user redirect again to the index page, and the form appear again
So, how to disable this, i have some ideas but not works, if i can use cookies or sessions or jquery? Currently i am using laravel 5.4
i tried this, but doesn't work
in my controller
public function postEmailPosts(Request $request){
$this->validate($request,[
'email' => 'required|unique:sub_scribers',
]);
$cookie = Cookie::make('submit',1, 60);
SubScriber::create($request->all());
return redirect()->back();
}
and in my index i have this code
@if(Session::get('submit')==1)
<div class="subscribe-me text-center">
<h1>كن دائما مع أخبار البادية</h1>
<h2>إشترك في القائمة البريدية لمجلة البادية</h2>
<a href="#close" class="sb-close-btn"><img class="<img-responsive></img-responsive>" src="src/images/others/close-button.png" alt="" /></a>
<form action="{{ route('email.subscribe') }}" method="post" id="popup-subscribe-form" name="subscribe-form">
<div class="input-group">
<span class="input-group-addon"><img src="src/images/others/icon-message.png" alt="" /></span>
{!! Form::email('email',null,['placeholder'=>'إدخل البريد اﻹلكتروني']) !!}
<button type="submit" name="subscribe">أذهب</button>
<input type="hidden" name="_token" value="{{ Session::token() }}">
</div>
</form>
</div> <!--/.subscribe-me-->
@endif
thank you at all