0

I got this error message - *syntax error, unexpected '[', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$'" * while working on CodeIgniter 4

class CreateProducts extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'id' -> [ //error line
                'type'-> 'INT',
                'constraint'-> '11',
                'unsigned' -> true,
                'auto_increment' -> true,
            ],
            'title' -> [
                'type' -> 'VARCHAR',
                'constraint' -> 255,
            ],
            'description' -> [
                'type' -> 'TEXT',
                'null' -> true,
            ],
            'price' -> [
                'type' -> 'DECIMAL',
                'constraint' -> '10,2'
            ]
        ]);

UPDATE: Solution here https://codeigniter.com/user_guide/dbmgmt/migration.html?highlight=s

0 Answers0