mardi 4 octobre 2016

Linking edit button from table to Laravel Edit form

I have a table that displays the data from my database. at the end of each row I have an Edit/Update Button. I would like it when clicking on the edit button it reference the the Edit Form.

My edit form works. I can access the data when visiting computers/{id}/edit, The form displays the current data and I can edit the data and submit the updates and it updates in the database (mysql).

This is my index.blade.php, which displays the table with the update button

@extends('layout')


@section('content')
    <h1>Inventory</h1>

        <table class="table table-striped">
            <thead>
                <tr>
                    <th>Last Name</th>
                    <th>First Name</th>
                    <th>Department</th>
                    <th>Building</th>
                    <th>Room</th>
                    <th>Manufacturer</th>
                    <th>Device</th>
                    <th>Model</th>
                    <th>Service Tag</th>
                    <th>Mac Address</th>
                    <th>Status</th>
                    <th>Comments</th>


                </tr>
            </thead>

            <tbody>

                @foreach($inventories as $inventory)
                    <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td>
                        
                        <button formaction="computers/{id}/edit"></button>
                        
                    </td>
            </tr>
                @endforeach
            </tbody>
        </table>


@stop



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire