ainsley_clark
1 month ago
154
4
Laravel

Run DB Setup for CMS only once

Posted 1 month ago by ainsley_clark

Hi there,

I'm trying to wrap my head around some logic and wondering if you could help.

Im making a CMS, it scans a directory and gets a json file and goes on to create tables & performs some actions to get the database set up, based on the json data.

Im wondering how to run this function only once? How you would approach this?

Below is an example of what function I would be running.

/**
 * Set global theme
 */
public function setTheme($theme)
{
    if (!$theme) {
        return false;
    }

    $themeInfo = $this->getThemeConfig($theme)->theme;

    //Insert config to DB

}

Many thanks in advance.

Please sign in or create an account to participate in this conversation.