I have no clue why this error comes up. I've re-check my code, and it was as documentation instructed.
This my route:
Route::get('/insurer/{insurer}', [InsurerController::class, 'show'])->middleware(['auth'])->name('insurer.show');
And this how I called it
return redirect()->route('insurer.show', $this->insurerId);
I also tried:
return redirect()->route('insurer.show', ['insurer' => $this->insurerId]);
And not working.
@ericknyoto Is the route wrapped in a group that requires another parameter? It’s hard to diagnose since you’ve not shown us the full error. Which required parameter is missing?
So, two possibilities:
The value you’re trying to use for the insurer parameter is null.
There’s another required parameter that you’re not passing a value for.
Finaly, I managed to make it work, by passing the model instead of Id. I don't know why it will throw parameter missing of I passed only Id. I thought Laravel will auto injection.
maybe am also missing the whole picture... from my understanding $this is an instance of your current class... Or the variable you are trying to call, hasnt been defined yet...
public function anyFunc($yourvariable){
return Yourfunction($yourvariable);
}
or
public $variable;
public function anyFunc(){
return Yourfunction($this->variable);
}
unless you are calling this from the insurer class/ model to be specific