I am trying to get data from database, so I tried to doit with $Get. Sİnce there will not be any user entered data.
This is my controller
class HotelController extends Controller
{
public function actionIndex($id) {
$this->view->title = 'List Hotels';
$items = ArrayHelper::map(Hotel::find()->all(),'id','name');
$model = Hotel::find($id)->all();
return $this->render('index', [
'items' => $items,
'model' => $model
]) ;
}
This is the my view code
<?php
/* @var $this yii\web\View */
use yii\helpers\Html;
$this->title = ‘Hotel list’;
$this->params[‘breadcrumbs’][] = $this->title;
?>
<? $item->name ?>
<?php endforeach; ?>The error I got bad request missing required parameter $id. How can I fix that?
—public function actionIndex($id)— does this code( —public function actionIndex($id)— ) says bring the id column from database or something else? I am beginner in yii I am sorry if the question is so easy. Thanks