Recent Topics

how to create new migration table in bagisto



  • As migrations was written in each folders seperately,can anyone suggest me an example to create a migration table in bagisto?



  • Hi @vinay2430

    Run migration command normally as you do in laravel then migration file will be generated in laravel's default database folder (migrations) then move this file to your package's migration folder.

    Thanks



    1. Create your migration file as you always do in laravel
    php artisan make:migration create_my_table
    
    1. inside the /src folder from your package create a new folder Database.
    2. Go to the Database folder and create a new folder Migrations.
    3. Copy your generated migration file to packages/My/Package/src/Database
    4. Open your package service provider and add your migrations folder to the boot method
    class MyPackageServiceProvider extends ServiceProvider
    {
        /**
         * Perform post-registration booting of services..
         *
         * @return void
         */
        public function boot()
        {
            $this->loadMigrationsFrom(__DIR__.'/../Database/Migrations');
        }
    

Log in to reply