PHP code example of quansitech / antd-admin

1. Go to this page and download the library: Download quansitech/antd-admin 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/ */

    

quansitech / antd-admin example snippets


    use Qscmf\Lib\Inertia\Inertia;
    
    $this->inertia('Index', [
        // 页面的props
        'foo' => 'bar'
    ])
    
    // 或使用全局 Inertia 类
    Inertia::render('Index', [
        // 页面的props
        'foo' => 'bar'
    ]);
    
 

use AntdAdmin\Component\Form\ColumnsContainer;

class ExtraProvider implements Provider{

    public function register(){

        // 注册 AntdAdmin Extra 列类型
        ColumnsContainer::registerType('extra', ExtraColumn::class);

        ...
    }

    ...
}

// 然后就可以使用

/** @var $container AntdAdmin\Component\Form\ColumnsContainer */
$container->extra('extra', '额外表单项');


use AntdAdmin\Component\ColumnType\BaseColumn;

class Extra extends BaseColumn {
  protected function getValueType(): string
    {
        return 'extra'; //与前端组件名对应
    }
}


$form->columns(function(Form\ColumnsContainer $container){
  $container->addColumn(new Extra('data_extra', '额外组件'));
});