Skip to content
On this page

General Settings

Dashcode is provided with global general-settings support with Spatie's Laravel-settings package. Here we are going to show you how you can use this feature on your project.

TIP

You can find laravel-settings official documentation here Laravel-settings.

Setup

  1. Navigate to database/settings/2022_12_12_105531_create_general_settings.php and add your keys with default values. E.g.
php
$this->migrator
            ->add(
                'general-settings.guest_background',
                asset('/images/guest-background.svg'));
  1. Navigate to app/Settings/GeneralSettings.php and add the property you added previously in settings migration. E.g.
php
public string $guest_background;
  1. Run php artisan migrate command to migrate your database.

Blade helper

  • getSettings('your_key'). E.g.
html
<img src="{{ getSettings('guest_background') }}" alt="logo">

COPYRIGHT © 2022 Codeshaper, All rights reserved.