getherbert / herbert

The WordPress Plugin Framework:
http://getherbert.com/
632 stars 94 forks source link

Tables active is not called when activating the plugin #139

Open giwrgos88 opened 8 years ago

giwrgos88 commented 8 years ago

I have used the examples of the herbert ("example plugin", "worpdress-socializr") and i have created a table migration to create a table when the plugin is activated. What I did is that I have created a folder called "Tables" inside the app folder and inside of that folder the following class

<?php

namespace App\Tables;

use Illuminate\Database\Schema\Blueprint;

class Settings
{
    /**
     * Creates the table.
     *
     * @param \Illuminate\Database\Schema\Blueprint $table
     */
    public function activate(Blueprint $table)
    {
        $table->increments('ID');
        $table->date('start_date');
        $table->date('end_date');
        $table->boolean('active');
        $table->timestamps();
    }
    /**
     * Deactivates the table.
     *
     * @param \Illuminate\Database\Schema\Blueprint $table
     */
    public function deactivate(Blueprint $table)
    {
        //
    }
    /**
     * Deletes the table.
     *
     * @param \Illuminate\Database\Schema\Blueprint $table
     */
    public function delete(Blueprint $table)
    {
        $table->drop();
    }
}

and then I have added the following array into the "herbert.config.php"

    /**
     * The tables to migrate.
     */
    'tables' => [
        'settings'  => 'App\Tables\Settings'
    ],

but it looks like is not working. Does anyone know why? What I'm doing wrong?