Read Story
Avail Here
Visit Here
Ayush Bhatt

How to make frontend changes for all the Tenants as a Super Admin

Introduction

You recently made a purchase of Multi Tenant SAAS module of Bagisto. Now, you might want to do some tweaks in the theme for all the tenants from Super Admin panel but there aren’t much functionalities for front end tweaks. So today in this tutorial, we’ll see the correct way how one can make changes in front end for all the tenants as a Super Admin. Let’s get started.

In order to achieve there are few very easy  steps involved that you need to follow. Below are those mentioned steps:

Step 1: Create configuration for super Admins.

  1. Create a new package. If you don’t know how to create a package, Refer below doc
    https://devdocs.bagisto.com/1.x/packages/create_package.html
  2. After Creating a package, create menus in Super Admin panel.
    Creating menus in Super Admin is almost similar to that of creating menus in Admin so you can either take a look in previously created Menus or refer this:
    https://devdocs.bagisto.com/1.x/packages/add_menu_in_admin.html

Step 2: Create a style.php file

Create a style.php file inside:

Package Name -> src -> Resources -> views -> style.php

What will style.php do ?
In this file we will pick the colors of particular places super Admin end (which we have created recently), and change those colors in css file.

Here, I have picked the colors from Super Admin with a condition where if the colors from super admin are not set, It will take the default colors.

Step 3: Call style.php from event service provider

Next step is to fire an event where your theme will pick up these settings whene the theme will be loaded on server.

Create an EventServiceProvider.php file in the same package:

Package Name -> Providers -> EventServiceProvider.php

In the above code I have rendered an event and called my style.php file.

Step 4: Register your event service provider to service provider

This is one very easy step and most of you have already know how to do that.

You just have to create a service provider and add your event service provider file in it.

And you are done.

Now the colors can be changed of header and navbar for a single tenant.

Let’s check out a live example

We have a domain with the name bagsaas.com

We’ll create sub domains for tenants:
1. site1.bagsaas.com
2. site2.bagsaas.com

Now we’ll just change the color from Super Admin

site1.bagsaas.com frontend

So that’s how you can make changes in all the tenant from the Super Admin Panel.

. . .

Comment

Add Your Comment

Be the first to comment.

css.php