7 months ago

edit route and select option form

Posted 7 months ago by NathanK


I have a landing page with Create, Edit and Delete buttons, The Edit button is linked to a select (dropdown) menu and my route for the URL is /events/{number}/edit.

How will I get my URL to write to this format as the page will already be loaded and then the selection is made.

<div class="col-sm-4">
                    <form method="get" action="{{ route('events.edit', ['event_id' => '2']) }}">
                        <label>Event Name</label>
                        <select name="event_edit" class="form-control form-control-lg">
                            @foreach($events as $event)
                        <button type="submit" class="btn btn-primary btn-round">Edit</button>

The above works but I have to put the event_id manually which is set to 2, will javascript be needed for this one?

Route::resource('events', 'EventController');
GET|HEAD  | events/{event}/edit    | events.edit      | App\Http\Controllers\[email protected]                              | web    

Please sign in or create an account to participate in this conversation.