madtechservices/madmin-core

1.0.4 2024-01-18 03:40 UTC

This package is auto-updated.

Last update: 2024-11-18 05:43:12 UTC


README

GitHub last commit

Documentation

Installation

For a completely new project, the following commands should be run for installation:

laravel new PROJECT-NAME

composer require backpack/crud

composer require --dev backpack/generators

Create a database and add it in the .env file!

php artisan backpack:install

Important: If you want to develop the madmin-core package, you need to create a packages folder in the root directory, and checkout the repo there!

composer require madtechservices/madmin-core

Install Backpack PRO extension: https://backpackforlaravel.com/products/pro-for-unlimited-projects (Installation section)

composer require backpack/pro



After Installation

After running the commands, set the following values in the configuration files:

config\backpack\base.php

'view_namespace' => 'madmin-core::',

'default_date_format' => 'YYYY. MMM. D.',

'default_datetime_format' => 'YYYY. MMM. D. HH:mm',

'avatar_type' => 'getProfileImageUrl',

'guard' => null,

'passwords' => null,

'project_name' => 'PROJECT-NAME',

'project_logo' => 'PROJECT-NAME',

'home_link' => '', // Only for admin systems, otherwise 'admin'

'developer_name' => 'MAD Tech Services',

'developer_link' => 'https://madtechservices.com.au',

'show_powered_by' => false,


config\app.php

'timezone' => 'Europe/Budapest',

'locale' => 'hu',


config\base.php

'middleware_class' => [ ... \Madtechservices\MadminCore\app\Http\Middlewares\SetLangMiddleware::class, ]

config/backpack/crud.php

Fill in the locales here, which are the selectable languages.

config\auth.php

'model' => Madtechservices\MadminCore\app\Models\User::class,


database\seeders\DatabaseSeeder.php

    public function run()
    {
        $this->call(\Madtechservices\MadminCore\Database\Seeds\MadminSeeder::class);
    }

app\Providers\RouteServiceProvider.php

public const HOME = '/';


Don't forget to fill in the .env file correctly!

After this, you just need to run the following few commands:

php artisan migrate --seed

php artisan vendor:publish --tag=config



Optional packages / extensions

Modified Backpack design

php artisan vendor:publish --tag=scss --force

Modify the colors in the backpack-overrides.scss file in the :root { selector. To generate colors, it's worth using this: https://ionicframework.com/docs/theming/color-generator

Add a new element to the vite.config.js file in the laravel -> input array:

'resources/scss/backpack-overrides.scss'

Add the new element to the config/backpack/base.php -> vite_styles array:

'resources/scss/backpack-overrides.scss',


yarn then run yarn dev.


System level logging

Open the app\Exceptions\Handler.php file and modify the register method to this:

    public function register()
    {
        $this->reportable(function (Throwable $e) {
            if ($this->shouldReport($e)) {
                store_system_logs($e);
            }
        });
    }

Larastan

The package is pre-installed but for each system, the phpstan.neon config file needs to be created.

https://packagist.org/packages/nunomaduro/larastan#1.0.3

Later, run ./vendor/bin/phpstan analyse or automate it.