Answer the question
In order to leave comments, you need to log in
How to implement edit method in Laravel?
I have the following route:
user/{login}/accounts/{account}/edit
I am trying to implement the edit() method in the resource controller like this:
public function edit(Account $account)
{
return view('user.account.edit', [
'account' => $account
]);
}
public function edit($id)
{
$account = Account::find($id);
return view('user.account.edit', dd($account));
}
Answer the question
In order to leave comments, you need to log in
You have two parameters in the route, and you are trying to accept only one in the method, and the second one. And the framework passes both there, as you asked.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question