i am unable to post a form and print it on. As u can see form my route:list i have worked on another controller called OrderController
and everything on that was fine. but after finishing the OrderController
i moved to the account Controlling step and got stuck where i cannot POST a form and see the values i entered on it. also if i use the named route it shows accountsAccountController@store
as a URL. also on the route list the Action is different from every other route action also the uri. Can someone explain me? what have i done wrong? i just couldn't figure it out tried a lot.
Route: Route::post('/accounts'. 'AccountsController@store');
Controller:
public function store() {
dd(request()->input);
return ('test');
}
Form:
<form action="/accounts" method="POST">
@csrf
<div class="form-row">
<div class="col-md-2 mb-3">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" placeholder="someone" name="name" required>
<div class="valid-feedback">
Looks good!
</div>
</div>
<div class="col-md-2 mb-3">
<label for="email">Email</label>
<input type="text" class="form-control" id="email" placeholder="someone@some.com" name="email" required>
<div class="valid-feedback">
Looks good!
</div>
</div>
<div class="col-md-2 mb-3">
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="password" required placeholder="***********">
</div>
</div>
<div class="col-md-2 mb-3">
<label for="district">District</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="inputGroupPrepend">@</span>
</div>
<input type="text" class="form-control" id="district" aria-describedby="inputGroupPrepend" name="district" required placeholder="">
<div class="invalid-feedback">
Please choose a username.
</div>
</div>
</div>
<div class="col-md-1 mb-3">
<div class="form-group">
<label for="role">Role</label>
<select class="form-control" id="role" name="role">
<option>Select a role</option>
<option value="admin">Admin</option>
<option value="staff">Staff</option>
</select>
</div>
</div>
<div class="col-md-1 mb-3">
<label for="validationCustomUsername"> </label>
<div class="form-group">
<button type="submit" class="btn btn-primary">Add</button>
</div>
</div>
</div>
</form>
Error: Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The POST method is not supported for this route. Supported methods: GET, HEAD. http://127.0.0.1:8000/accounts
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire