0

I need to access one of my database tables in the boot method of my plugin. The problem is that the first time that the plugin is installed, in the boot method, the tables have not been created yet, because the migration files are yet to be executed. So where is a safe place to access database tables the first time that my plugin is installed? How can I make sure that all migration files have been executed before accessing the database?

B Faley
  • 17,120
  • 43
  • 133
  • 223

1 Answers1

1

It's as simple as the following:

if (Schema::hasTable('my_plugin_table')) {
    $this->doSomeStuff();
}
LukeTowers
  • 1,262
  • 7
  • 14