yii-admin
Requirements
Installation
一、Install yii advanced, (*1)
二、Add yii database connection config
``` php
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=xxx',
'username' => 'xxx',
'password' => 'xxx',
'tablePrefix' => 'xxx_',
'charset' => 'utf8',
],, (*2)
二、
``` bash
composer require eddycjy/e-admin
三、Create AdminController.php and add code on the yii console, (*3)
``` php
<?php
namespace console\controllers;, (*4)
class AdminController extends \yii\console\Controller
{
public function actionInit()
{
\Eadmin\Start::init([]);
}, (*5)
public function actionFlush()
{
\Eadmin\Start::flush([]);
}
public function actionDelete($name)
{
\Eadmin\Start::delete($name);
}
}, (*6)
四、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:
``` php
'on beforeAction' => ['Eadmin\Config', 'init'],
Demo:, (*7)
return [
'id' => 'app-backend',
'components' => [ ... ],
...
'on beforeAction' => ['Eadmin\Config', 'init'],
...
];
二、Add Console Config Path: $APP/console/config/main.php, (*8)
This configuration is only used when the console is generated, (*9)
Add config in components:, (*10)
``` php
'session' => [
'class' => 'yii\web\Session',
],, (*11)
Demo:
``` php
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, (*12)
一、Set up website information: Setting.php, (*13)
二、Set up Database: Database.php, (*14)
三、Set up model Autoload: Autoload.php, (*15)
Generate
In the yii directory, run the following command to complete the generation, (*16)
``` bash
./yii admin/init, (*17)
if error, you can
``` bash
./yii admin/flush
or delete specified options (support modelName and runtime catalogName ), (*18)
bash
./yii admin/delete [options], (*19)
Other
License
MIT, (*20)