Create Menu


Menus are a collection of links (menu items) used to navigate a website. For more details, see CMS Menus's documentation

For creating menu, you need to follow some steps:

1. Create Location through seeds.

Create a json file of name theme_locations.json at VaahCms/Themes/BlogTheme/Database/Seeds/json/ this directory.


        "type": "menu",
        "name": "Top",
        "excerpt": "Top of every page"
      ├── BlogTheme
          ├── Database/
              ├── Seeds/
                  ├── DatabaseTableSeeder.php
                  ├── SampleDataTableSeeder.php
                  ├── json/
                      ├── theme_locations.json

To run this seed, you have to add some code in DatabaseTableSeeder.php file.

namespace VaahCms\Themes\BlogTheme\Database\Seeds;

use Illuminate\Database\Seeder;
use VaahCms\Modules\Cms\Libraries\CmsSeeder;

class DatabaseTableSeeder extends Seeder
     * Run the database seeds.
     * @return void
    public function run()
        $theme_slug = 'blogtheme';

        $file = __DIR__.'/json/theme_locations.json';
        CmsSeeder::themeLocations($theme_slug, $file);

     * Run the database seeds.
     * @return void


Now, you just need to reactivate the theme by visiting this url:


Once, the theme is activated, Location will also be created.

2. Create a Menu.

To create Menu, visit this url:

  • Select Theme
  • Select Location
  • Create Menu Or Select existing Menu
{!! vh_location('top', true) !!}

Now, you can copy this code and paste it in home blade file. Remove hard code of menu.

<div class="tabs is-right">
                                    <li class="is-active"><a>Home</a></li>
                                    <li><a href="">Examples</a></li>
                                    <li><a href="">Features</a></li>
                                    <li><a href="">Team</a></li>
                                    <li><a href="">Help</a></li>
                                <span class="navbar-item">
                                        <a class="button is-white is-outlined"
                                            <span class="icon">
                                                <i class="fa fa-github"></i>
                                            <span title="Hello from the other side">View Source</span>

                                {!! vh_location('top', true) !!}

Now, You can see the CMS menu.


Copyright © 2024