2. Creating The Migration File

P.S. If you need help with this feel free to contact me, but only if you have tried yourself.

Head to the folder app/database/themes

There you need to create a folder. This folder will be your theme name. It should be lower case. This folder will automatically be recognized on the management page under the themes under "Uninstalled Themes".

Then you will need to create a migration file. This file is what allows your theme to actually be installed on the database.

In that folder you will need to create a migration file. The file should be called 0000_00_00_00000_themename.php the numbers in the beginning are required for the migration to actually be recognized by Laravel.

Here is the template:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class Themename extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::table('themes')->insert([
            'name' => 'themename',
            'image' => 'https://example.com/image.jpg'
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}

Just in case you need a little more clarity. I will provide a real life example.

Let's say I created a theme called "Orion".

I will make a folder called "orion" in the app/database/themes folder

I will then make a migration file called 0000_00_00_00000_orion.php inside the app/database/themes/orion folder

This is what the Orion migration file will look like: https://pastebin.com/qS1ySM71

Pretty easy right? babl will then automatically present the theme in the management page under the themes tab, allowing the user to install the theme and start using it.

Last updated