First setup the database and modify the CRUD files as recorded [[ create_a_simple_join|here]]\\

You will now be able to modify the //Employee// and //Company// databases as needed.\\

Now to show it on the main SiteController is easy.\\

Say on the main site index page, we wish to show the Employee GridView.\\

Edit the ''\controllers\SiteControllers.php'' file, add near the top
<code php>
use app\models\Employee;
use app\models\EmployeeSearch;
</code>

Then modify **actionIndex**
<code php>
    public function actionIndex()
    {
        $searchModel = new EmployeeSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        return $this->render('index', [
            'searchModel' => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }
          
</code>

Modify the ''\views\site\index.php'' as follows.\\
At the top, put
<code php>
use yii\helpers\Html;
use yii\grid\GridView;
</code>

and below the ''<div class="body-content">''
<code php>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'company_id',
            [
                'attribute' => 'Company Name',
                'value' => 'company.name'
            ],
            'emp_name',
            'emp_email:email',
            'emp_salary',
            //'expiry_date',
            //'created_at',
            //'modified_at',
        ],
    ]); ?>
</code>

This will show the same GridView as in the \\Employee\\ update page. We have removed the ''['class' => 'yii\grid\ActionColumn'],'' so as not the show the editing buttons..


