PHP code example of denis-kisel / laravel-admin-widget

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

    

denis-kisel / laravel-admin-widget example snippets


Admin::js('/js/admin/jquery-ui.min.js');
Admin::script('$(function() {
    $(\'.has-many-{items}-forms\').sortable();
});');

public function form()
{
    Admin::js('/js/admin/jquery-ui.min.js');
    Admin::script('$(function() {
            $(\'.has-many-items-forms\').sortable();
        });');

    $data = Widget::getArray($this->code);
    $form = new \Encore\Admin\Widgets\Form($data);

    $form->repeat('items', function (NestedForm $form) {
        $form->textarea('title', __('admin.title'));
        $form->image('image', __('admin.image'));
    });

    $form->action(url()->current());

    return $form->render();
}
 php
/*
 * Package Service Providers...
 */
DenisKisel\LaravelAdminWidget\LaravelAdminWidgetServiceProvider::class,
 bash
$  php artisan vendor:publish --provider="DenisKisel\\LaravelAdminWidget\\LaravelAdminWidgetServiceProvider"
 bash
$  php artisan migrate
 bash
$ php artisan admin:widget Slider
 php


use DenisKisel\LaravelAdminWidget\Facade\Widget;


Widget::getArray($code)
 php


use DenisKisel\LaravelAdminWidget\Facade\Widget;


Widget::getCollection($code)
 php


use DenisKisel\LaravelAdminWidget\Facade\Widget;


Widget::put($code, $data) #Store or update widget
bash
php artisan fix:nested_form