PHP code example of ofilin / yii2-fillmodel

1. Go to this page and download the library: Download ofilin/yii2-fillmodel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ofilin / yii2-fillmodel example snippets


public function actionCreate()
{
    $model = new Posts();
    
    // Add this line:
    \ofilin\fillmodel\Fill::model($model, ['groups', 'scheduled_date', 'scheduled_time']);

    if ($model->load(Yii::$app->request->post()) && $model->save()) {
        return $this->redirect(['index']);
    }
    return $this->render('create', [
        'model' => $model,
    ]);
}