PHP code example of bacao / laravel-admin-hasmany-extra

1. Go to this page and download the library: Download bacao/laravel-admin-hasmany-extra 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/ */

    

bacao / laravel-admin-hasmany-extra example snippets


$form->hasmanyExtraMultipleImage('banner', 'Banner');

\Encore\Admin\Form::extend('hasmanyMultipleImage', \Encore\HasmanyExtra\Fields\HasManyMultipleImage::class);

$form->hasMany('items', '商品项目', function (Form\NestedForm $form) {
    $form->hasmanyExtraMultipleImage('banner', 'Banner图')
        ->uniqueName()
        ->removable()
        ->sortable();
});

$form->hasMany('items', '商品项目', function (Form\NestedForm $form) {
    $form->radio('type', '类型')->options([
        1 => '厨师介绍',
        2 => '餐品介绍',
        3 => '菜单介绍',
        4 => '酒店介绍',
    ])->when(3, function (Form\NestedForm $form) {
        $form->textarea('menu', '菜单');
    });
});

$form->hasMany('items', '商品项目', function (Form\NestedForm $form) {
    $form->table('menu', '子菜单', function ($table) {
        $table->text('name', '名称');
        $table->textarea('desc', '描述');
    });
});