I have an array, Vehicles, "id" and "vehicle", like this database table:
Vehicles
1.Car
2.Truck
3.Bicycle
4.Motorcycle
I make a model of the table, and CRUD it, I am given this generated code in vehicle/index
:
<?= ListView::widget([
'dataProvider' => $dataProvider,
'itemOptions' => ['class' => 'item'],
'itemView' => function ($model, $key, $index, $widget) {
return Html::a(Html::encode($model->vehicle), ['view', 'id' => $model->id]);
},
]) ?>
I see now a list with all my vehicles as links:
Car,
Truck,
Bicycle,
Motorcycle
What I want, is the links to get me somewhere, like this:
Car - vehicles/car,
Truck - vehicles/truck
...etc
I will have to hard-code the paths, I guess. Is there a convenient way to do this, in the Html::a function given above? Or should I use another type of function?