I haven't used the HTML Helpers
since 4.2 so I don't know if they are doing it automatically for you. But for PUT
, PATCH
, and DELETE
methods you need to have a hidden input field. This field needs to be called _method
.
You can read about it here: https://laravel.com/docs/5.3/routing#form-method-spoofing
They do automatically put it in. I checked the html, printed here for you:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Missionseek</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/css/app.css">
</head>
<body>
<div class="flex-center position-ref full-height">
<div class="top-right links">
<a href="http://localhost:8000/Agency">Agencies</a>
<a href="http://localhost:8000/User">Users</a>
<a href="http://localhost:8000/login">Login</a>
<a href="http://localhost:8000/register">Register</a>
</div>
<div class="container">
<h1>This is a test.</h1>
<ul>
</ul>
<form method="POST" action="http://localhost:8000/users" accept-charset="UTF-8" class="form"><input name="_method" type="hidden" value="PUT"><input name="_token" type="hidden" value="xmTLggTGICaRCzTrp9oJPfebzhN20cdCXj5p00kY">
<div class="form-group">
<input type="hidden" name="_token" value="xmTLggTGICaRCzTrp9oJPfebzhN20cdCXj5p00kY">
<label for="Your Name">Your Name</label>
<input required="required" class="form-control" placeholder="Your name" name="name" type="text" value="Jonnyboy">
</div>
<div class="form-group">
<label for="Your E-mail Address">Your E-mail Address</label>
<input required="required" class="form-control" placeholder="Your E-mail Address" name="email" type="text" value="[email protected]">
</div>
<div class="form-group">
<input class="btn btn-primary" type="submit" value="Submit">
</div>
</form>
</div>
</body>
</html>
Problem solved. $user->id needed to be $user->ID. This is sometimes allowed by laravel, but in this case the capitalisation was strict.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community