Setting

General Setting

Introduction

The Settings page gives developers the ability to access all backend functionality of the app. Along with accessing this information, developers can further customize the backend functionality of their application.

The Settings page automatically opens under the General tab. Here, you can update Site Title, set the format of Date Time and do many more things.

Visit following url you will see the Setting section:

<project-url>/backend#/vaah/settings/general
general-setting1

Settings are divided into 5 section.

------
Site Settings
general-setting2
Field NameDescription
Site TitleTitle of Site
Meta DescriptionContent of Meta Description
Default Site LanguageCurrent Site Language
Search Engine VisibilityThe site will be discouraged to be indexed by search engines
Copyright TextThe Copyright Text
Copyright LinkRedirect to this link when click on Copyright Text
Copyright YearThe Copyright year
Assign Role(s) on RegistrationAssign these Roles on new Registration.
Allowed file types for uploadThese File Type will be allowed for upload.
Maintenance ModeThe site will display a maintenance page only.
Password ProtectionThe site will only be accessing using this password for logged in user.
Laravel QueuesThis will enable the Laravel Queue feature.
Redirect after Backend LogoutRedirect to this Url after Logout from Backend
Redirect after Frontend LoginRedirect to this Url after Login in Frontend
Maximum number of forgot password attempts per sessionNumber of Clicks on Forgot Password Button
Maximum number of login attempts per sessionNumber of Clicks on Login Button

Clear Cache: This will clear cache of your Application. You can also directly visit:

<project-url>/clear/cache

Date & Time
general-setting3
Field NameDescription
Date FormatSet Format of Date
Time FormatSet Format of Time
Date Time FormatSet Format of Date Time

general-setting4
Field NameDescription
FacebookStatic Facebook Link
TwitterStatic Twitter Link
LinkedinStatic Linkedin Link
YoutubeStatic Youtube Link
InstagramStatic Instagram Link
GithubStatic Github Link

Scripts
general-setting5
Field NameDescription
After head tag start (<head>)Added Scripts visible after head tag start (<head>)
After body tag start (<body>)Added Scripts visible after body tag start (<body>)
Before head tag close (</head>)Added Scripts visible before head tag close (</head>)
Before body tag close (</body>)Added Scripts visible before body tag close (</body>)

Meta Tags
general-setting6
Field NameDescription
Meta TagsAdd Meta Tags

How to create Setting

You can create a Setting through Seeds and add a field on Setting Form for that Setting.

Create a json file of name settings.json at .../Database/Seeds/json/ this directory.

settings.json

[

    {
        "category": "global",
        "key": "site_title",
        "value": "VaahCMS"
    },
    {
        "category": "global",
        "key": "site_description",
        "value": "Another awesome site on VaahCMS"
    }

]

To run this seed, you have to create seedSetting() method in DatabaseTableSeeder.php file.

public function seedSettings()
    {


        $list = $this->getListFromJson("settings.json");

        foreach($list as $item)
        {
            $exist = \DB::table( 'vh_settings' )
                ->where( 'category', $item['category'] )
                ->where( 'key', $item['key'] )
                ->first();

            if (!$exist){

                if(isset($item['type']) && $item['type']=='json')
                {
                    $item['value']=json_encode($item['value']);
                }

                \DB::table( 'vh_settings' )->insert( $item );
            } else{
                \DB::table( 'vh_settings' )
                    ->where( 'category', $item['category'] )
                    ->where( 'key', $item['key'] )
                    ->update($item);
            }
        }

    }

Now you just have to create a field in Setting page at .../Vue/pages/settings/ directory.



Copyright © 2024