Home >PHP Framework >Laravel >The new expansion system is online! Release Dcat Admin v2.0.0-BETA version~

The new expansion system is online! Release Dcat Admin v2.0.0-BETA version~

藏色散人
藏色散人forward
2020-10-20 13:53:034606browse

The following is the tutorial column of Laravel to introduce the release of Dcat Admin v2.0.0-BETA. I hope it will be helpful to friends in need!

The new expansion system is online! Release Dcat Admin v2.0.0-BETA version~

PrefaceHi, hello classmates! After many days, Dcat Admin

finally ushered in the first version of

2.0. Here is a brief introduction to the main changes. Everyone is welcome to install and experience it. If there are any problems, they will be fixed immediately~Installation

The v2.0.1-beta version has been released

composer require dcat/laravel-admin:v2.0.1-beta -vvv

What are the changes?

1. Extension We have focused on optimizing the extension

function in this version, mainly simplifying The extension usage process allows users to install, uninstall, and upgrade extensions through the page, and supports both page compression and

composer installation methods. The App Market function will be launched when the official version is released, so stay tuned~The detailed usage documentation will be gradually updated this week~

2. Enhance form layout capabilitiesIn 2.0

, we have

The block layout function has been refactored to support more complex layouts. Example

$form->block(8, function (Form\BlockForm $form) {
    $form->title('基本设置');
    $form->showFooter();
    $form->width(9, 2);

    $form->column(6, function (Form\BlockForm $form) {
        $form->display('id');
        $form->text('name');
        $form->email('email');
        $form->image('avatar');
        $form->password('password');
    });

    $form->column(6, function (Form\BlockForm $form) {
        $form->text('username');
        $form->email('mobile');
        $form->textarea('description');
    });
});
$form->block(4, function (Form\BlockForm $form) {
    $form->title('分块2');

    $form->text('nickname');
    $form->number('age');
    $form->radio('status')->options(['1' => '默认', 2 => '冻结'])->default(1);

    $form->next(function (Form\BlockForm $form) {
        $form->title('分块3');

        $form->date('birthday');
        $form->date('created_at');
    });
});

##2.0 is also supported in

tab

Nested layouts use column and rows layouts, such as This function supports both data forms

and
Tool form

$form->tab('标题', function (Form $form) {
    $form->column(6, function (Form $form) {
        ...
    });

    $form->column(6, function (Form $form) {
        ...
    });});
3. Refactor the form response method

in version1.0 The response methods of the form are only

success

, error and redirect, which cannot meet some more complex scenarios. In 2.0 we let the form The response methods of action are unified to support more functions and reduce the learning cost of developers. In the data form<pre class="brush:php;toolbar:false">$form-&gt;saving(function (Form $form) {     return $form         -&gt;response()         -&gt;success('保存成功')         -&gt;script('console.log(&quot;执行JS代码&quot;)')         -&gt;redirect('auth/users');});</pre>In the tool form

public function handle(array $input){
    ...

    return $this
        ->response()
        ->alert()
        ->success('成功')
        ->detail('详细内容');}

4. Separation of JS code and PHP code

This function is a follow-up to the new features of laravel-admin2.0 version. In 2.0, it is recommended to put the

JS

code into the view file, example The code in <pre class='brush:php;toolbar:false;'>&lt;style&gt; .popover{z-index:29891015} &lt;/style&gt; &lt;div class=&quot;{{$viewClass[&amp;#39;form-group&amp;#39;]}}&quot;&gt; &lt;div for=&quot;{{ $id }}&quot; class=&quot;{{$viewClass[&amp;#39;label&amp;#39;]}} control-label&quot;&gt; &lt;span&gt;{!! $label !!}&lt;/span&gt; &lt;/div&gt; &lt;div class=&quot;{{$viewClass[&amp;#39;field&amp;#39;]}}&quot;&gt; @include(&amp;#39;admin::form.error&amp;#39;) &lt;div class=&quot;input-group&quot;&gt; &lt;span class=&quot;input-group-prepend&quot;&gt;&lt;span class=&quot;input-group-text bg-white&quot; style=&quot;padding: 4px&quot;&gt;&lt;i style=&quot;width: 24px;height: 100%;background: {!! $value !!}&quot;&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt; &lt;input {!! $attributes !!} /&gt; @if ($append) &lt;span class=&quot;input-group-append&quot;&gt;{!! $append !!}&lt;/span&gt; @endif &lt;/div&gt; @include(&amp;#39;admin::form.help-block&amp;#39;) &lt;/div&gt; &lt;/div&gt; &lt;script require=&quot;@color&quot;&gt; $(&amp;#39;{{ $selector }}&amp;#39;).colorpicker({!! json_encode($options) !!}).on(&amp;#39;colorpickerChange&amp;#39;, function(event) { $(this).parents(&amp;#39;.input-group&amp;#39;).find(&amp;#39;.input-group-prepend i&amp;#39;).css(&amp;#39;background-color&amp;#39;, event.color.toString()); }); &lt;/script&gt;</pre><script></script> and

The above is the detailed content of The new expansion system is online! Release Dcat Admin v2.0.0-BETA version~. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete