How to Program With Yii2: Working With the Database and Active Record (ok)
https://code.tutsplus.com/tutorials/how-to-program-with-yii2-working-with-the-database-and-active-record--cms-22768

C:\xampp74\htdocs\oectest\migrations\m230311_041200_create_status_table.php
<?php
use yii\db\Migration;
use yii\db\Schema;
/**
* Handles the creation of table `{{%status}}`.
*/
class m230311_041200_create_status_table extends Migration {
/**
* {@inheritdoc}
*/
public function safeUp() {
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%status}}', [
'id' => Schema::TYPE_PK,
'message' => Schema::TYPE_TEXT . ' NOT NULL DEFAULT ""',
'permissions' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
'created_at' => Schema::TYPE_INTEGER . ' NOT NULL',
'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL',
], $tableOptions);
}
/**
* {@inheritdoc}
*/
public function safeDown() {
$this->dropTable('{{%status}}');
}
}

C:\xampp74\htdocs\oectest\models\Status.php
C:\xampp74\htdocs\oectest\controllers\StatusController.php
C:\xampp74\htdocs\oectest\views\layouts\main.php
C:\xampp74\htdocs\oectest\views\status_form.php
C:\xampp74\htdocs\oectest\views\status\create.php
C:\xampp74\htdocs\oectest\views\status\index.php
C:\xampp74\htdocs\oectest\views\status\update.php
C:\xampp74\htdocs\oectest\views\status\view.php


PreviousHow to Program With Yii2: Exploring MVC, Forms and Layouts (ok)NextCreate Page Signup, login, article (ok)
Last updated