Ad
@csrf Is Not Working In Laravel 5.4
I am following this tutorial on Laravel and I've noticed that I cannot use the @csrf command, but others can use it effectively. But, I can use the {{ csrf_field() }} for the csrf token. I would like to know the reason why. Thanks.
Here's my screenshot on using the @csrf command: Image here
Here's my index.blade.php
<form action="{{ route('contact.store') }}" method="post">
@csrf
<div class="col-md-6 mb-3">
<label for="username">Username:</label>
<input class="form-control" type="text" name="name" id="username" placeholder="Username | Email | Phone Number" required>
<div class="invalid-feedback">
Please provide a username
</div>
</div>
<div class="col-md-6 mb-3">
<label for="password">Password:</label>
<input class="form-control" type="password" name="name" id="password" placeholder="" required>
<div class="invalid-feedback">
Please provide a password
</div>
</div>
<div class="col-md-6 mb-3">
<input type="submit">
</div>
</form>
Ad
Answer
As far as I know, there is no @csrf in 5.4, you must use
{{ csrf_field() }}
Instead, @csrf is available in laravel 5.6
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad