Reputation: 164
public function create(Request $request)
{
if (Request::isMethod('post'))
{
echo 'text';
exit;
}
}
<form action="{{route('create')}}" method="POST">
<input name="name" class="form-control" type="text">
<input name="email" class="form-control" type="email">
<input type="submit" class="btn btn-primary btn-lg btn-block" name="submit">
</form>
Route::post('/create', 'Tools\PostController@create')->name('create');
The page has expired due to inactivity. Please refresh and try again.
Upvotes: 0
Views: 1795
Reputation: 70
You are getting "The page has expired due to inactivity. Please refresh and try again" because you are not passing csrf token with the post request.
By default laravel reject any post request without the csfr token in the request.
Try this:
In your blade file include one hidden input like this :
<input name="token" type="hidden" value="{{ csrf_token() }}">
For more info please refer to the docs
Upvotes: 1