PHP code example of buddysoft / yii2-widget

1. Go to this page and download the library: Download buddysoft/yii2-widget library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

buddysoft / yii2-widget example snippets


$config['modules']['gii'] = [
    'class' => 'yii\gii\Module',
    // 添加下面内容
    'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'],
    'generators' => [
        'search' => [
            'class' => 'buddysoft\widget\generators\search\Generator',
            'templates' => [
                'myCrud' => 'buddysoft\widget\generators\search\default',
            ]
        ]
    ]
];


    // 不需要返回给客户端的字段,所有 Model 通用
    'secretFields' => ['id', 'createdAt', 'updatedAt', 'accessToken'],
    // 在某些请求中,依然需要返回给客户端,但是存在于 secretFields 数组中的字段
    'exceptFields' => [
        [
            'routes' => ['site/login'], // 如果设置了 url rules 重定向,必须使用重定向后的路由
            'models' => ['User'],       // 需要排除特殊字段的 Model 类名字
            'fields' => ['accessToken'],// 需要排除的字段名字
        ],
        [
            'routes' => ['notice/index', 'notice/view', 'receipt/index', 'receipt/view'],
            'models' => ['Notice', 'Receipt'],
            'fields' => ['createdAt', 'updatedAt'],
        ],
    ],