从编辑到更新如何在它们之间进行链接?

I'm trying to get from my edit page to my update page but there is nothing in the documentation that's explaining how to route to it. This is my form on my edit page:

/*
Or method="PUT"
*/
<form method="PATCH" action="../{{$id}}">
{{ method_field('PUT') }}
<input type="submit" value="edit"/>
</form>

My routes is being declared as a resource controller:

Routes::resource('/','TestController',['parameters' => [
    '' => 'test'
]]);

In my controller I just have:

public function update(Request $request, Test $test){
    return 'test';
}

It's just giving me different errors when trying to access the update action in multiple ways.

I tried: {{route($id)}} which gives me:

Route 1 not defined

The resource documentation gives me that the url is suppose to be like this:

PUT/PATCH   /photos/{photo} 

I dont understand the routing of resource controllers in laravel and theres not a lot to find about it. I even tried to simply go 1 back from /{{$id}}/edit like this: ../{{$id}}but that just brings me to the show action(since show and update have the same url apparently) and I also think this isnt the best way to access an action from the controller.

Try changing your form opening tag to be:

<form method="POST" action="{{ url($id) }}">
    {{ csrf_field() }}
    {{ method_field('PUT') }}

Hope this helps!

for a resource route you can have following methods in controller. Index

public function index()
    {
        return view();
    }

Create

public function create()
    {
        //
    }

Store

public function store(Request $request)
    {
        //
    }

show

public function show($id)
    {
        //
    }

Edit

public function edit($id)
    {
        //
    }

Update

public function update(Request $request, $id)
    {
        //
    }

Destroy

public function destroy($id)
    {
        //
    }

Create your controller using php artisan. then those resource methods will create automatically.