eddycjy/e-admin

e-admin

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Language:JavaScript

1.0.0 2017-12-15 07:48 UTC

This package is not auto-updated.

Last update: 2020-09-19 07:21:44 UTC


README

Requirements

  • PHP >= 5.6.0
  • YII >= 2.0

Installation

一、Install yii advanced

二、Add yii database connection config

'db' => [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=xxx',
    'username' => 'xxx',
    'password' => 'xxx',
    'tablePrefix' => 'xxx_',
    'charset' => 'utf8',
],

二、

composer require eddycjy/e-admin

三、Create AdminController.php and add code on the yii console

<?php
namespace console\controllers;

class AdminController extends \yii\console\Controller
{
    public function actionInit()
    {
        \Eadmin\Start::init([]);
    }

    public function actionFlush()
    {
        \Eadmin\Start::flush([]);
    }

    public function actionDelete($name)
    {
        \Eadmin\Start::delete($name);
    }
}

四、Write a Model instance of the eadmin ( vendor/eddycjy/eadmin/src/Work/Model )

Yii Configuration

一、Add Backend Config Path: $APP/backend/config/main.php

Add config:

'on beforeAction' => ['Eadmin\Config', 'init'],

Demo:

return [
    'id' => 'app-backend',
    'components' => [ ... ],
    ...
    'on beforeAction' => ['Eadmin\Config', 'init'],
    ...
];

二、Add Console Config Path: $APP/console/config/main.php

This configuration is only used when the console is generated

Add config in components:

'session' => [ 
    'class' => 'yii\web\Session',
],

Demo:

return [
    ...
    'components' => [
        'log' => [
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'session' => [ 
            'class' => 'yii\web\Session',
        ],
    ],
    ...
];

Eadmin Configuration

Add Config Path: vendor/eddycjy/eadmin/src/Config

一、Set up website information: Setting.php

二、Set up Database: Database.php

三、Set up model Autoload: Autoload.php

Generate

In the yii directory, run the following command to complete the generation

./yii admin/init

if error, you can

./yii admin/flush 

or delete specified options (support modelName and runtime catalogName )

./yii admin/delete [options]

Other

License

MIT