Laravel 5 obtenir de l'ID de l'URL

J'ai une table dans laquelle je peux cliquer sur un bouton de l'icône et de la rediriger vers une autre page portant le id de la ligne qui a été cliqué.

@foreach ($patients as $patient)
    <tr>
        <td>{{ $patient->pID }}</td>
        <td>{{ $patient->pName }}</td> 
        <td>{{ $patient->pAddress }}</td>
        <td>{{ $patient->pBday }}</td>
        <td>{{ $patient->pPhone}}</td>
        <td>{{ $patient->pEcon }}</td>
        <td>{{ $patient->pDreg }}</td>
        <td></td>
        <td>
            <a href="{{ URL::to('visit/'.$patient->pID) }}">
                <img src="../images/viewvisit.png" style="width:30px; height:30px;">
            </a>
        </td>
        <td>
            <a href="{{ URL::to('addeditvisit/'.$patient->pID) }}">
                <img src="../images/visit.png" style="width:30px; height:30px;">
            </a>
        </td>
        <td>
            <a href="{{ URL::to('editpatient/'.$patient->pID) }}">
                <img src="../images/update.png" style="width:30px; height:30px;">
            </a>
        </td>
        <td>
            <a href="{{ URL::to('deletepatient/'.$patient->pID) }}">
                <img src="../images/delete.png" style="width:30px; height:30px;">
            </a>
        </td>
    </tr>
@endforeach 

ce que je veux est d'obtenir le id à partir de l'URL et de le mettre dans une variable afin que je puisse utiliser mon autre page.

Je suis actuellement coincé avec cette fonction de contrôleur.

public function index(Request $request) {   

    $doctors = Doctor::where('dStatus', 0)
        ->lists('dName', 'dID');
    $beds = Bed::where('bStatus', 0)
        ->lists('bName', 'bID');
    $patient = Patient::patient();
    //$uri = $request->path('patient');

    return View::make('pages.addeditvisit', [
        'doctors'=>$doctors,
        'beds'=>$beds,
        'patient'=>$patient->pID
    ]);
}
Comment avez-vous défini vos routes?

OriginalL'auteur Kent Abrio | 2015-10-21