I'm using laravel 6. I have similar Controller with similar views in the same application which works fine. Still cannot find the error even after comparing both.
Facade\Ignition\Exceptions\ViewException
Missing required parameters for [Route: time.update] [URI: time/{time}].
(View: C:\xampp\htdocs\cms\resources\views\timeslot\edit.blade.php)
http://cms.test/time/4/edit
Error: return new static("Missing required parameters for [Route {$route->getName()}] [URI: {$route->uri()}].");
Link to edit:
<a href="{{route('time.edit',$timeslot->id)}}">{{$timeslot->timeslot_title}}</a>
Controller:
public function edit(Timeslot $timeslot){
return view('timeslot.edit',compact('timeslot'));
}
public function update(TimeslotRequest $request, Timeslot $timeslot){
$timeslot->update($request->all());
}
Edit form:
@extends('layouts.admin')
@section('content')
<h1>Edit Timeslot Details </h1>
<form action="{{route('time.update',$timeslot->id)}}" method="POST">
@method('PATCH')
@include('timeslot.form')
<button type="submit" class="btn btn-primary">Update Timeslot</button>
</form>
@endsection
route() second parameter is an associative array. It can automatically get the timeslot id if you pass an model. Assuming your model name in your route is 'timeslot'.
<a href="{{route('time.edit', ['timeslot' => $timeslot]}}">{{$timeslot->timeslot_title}}</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With