Remove All Tables

Permalink
How do I remove all tables from the package during uninstallation process?

 
JohntheFish replied on at Permalink Reply
JohntheFish
Is this for implementing in your own package, or to remove everything to do with a package you have installed?

With most packages, a lot depends on the package. Some will clean up all tables. Others may not, sometimes deliberately so in order to facilitate uninstalling and reinstalling while keeping data.
Scottyy replied on at Permalink Reply
This is for implementing in own package
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Declare an uninstall method in the package controller. First call the parent uninstall, then drop tables using drop table if exists
public function uninstall()
    {
        parent::uninstall();
        $db = $this->app->make('database')->connection();
        $db->executeQuery('DROP TABLE IF EXISTS myPackageTableName');
    }
Scottyy replied on at Permalink Reply
Ok, Thanks