0
我的路由和变量中存在问题。我需要将foreach循环中的变量传递给路由。这里是错误meesage“Route [patientName]未定义”。 这里是homepage.blade.php:Route [name]未在laravel 4.1中定义
@foreach($patientsList as $patients)
<tr>
<td>{{ $patients->name }}</td>
<td>{{ $patients->email }}</td>
<td>{{ $patients->address }}</td>
<td>{{ $patients->phone_number }}</td>
<td>{{ $patients->type }}</td>
<td><a href="{{ URL::route('patientName', array('pname' => $patients->name)) }}" class="view-profile">View Profile</a></td>
</tr>
@endforeach
routes.php文件:
Route::get('patientName/{pname}','[email protected]');
控制器
<?php
class PatientsController extends BaseController{
/*some functions*/
function getPatientName($patientName){
return $patientName;
}
}