当前位置:网站首页>Laravel admin hidden button, and set button display, default sequence, form form form non modifiable value

Laravel admin hidden button, and set button display, default sequence, form form form non modifiable value

2022-06-26 11:06:00 siner. li

Global concealment

stay bootstrap.php in

use Encore\Admin\Form;

Form::init(function (Form $form) {
    
    $form->tools(function (Form\Tools $tools) {
    
        //  Get rid of ` list ` Button 
        $tools->disableList();
        //  Get rid of ` Delete ` Button 
        $tools->disableDelete();
        //  Get rid of ` see ` Button 
        $tools->disableView();
    });
    $form->footer(function ($footer) {
    
        //  Get rid of ` see `checkbox
        $footer->disableViewCheck();
        //  Get rid of ` continue editing `checkbox
        $footer->disableEditingCheck();
        //  Get rid of ` Continue to create `checkbox
        $footer->disableCreatingCheck();
    });
});

\Encore\Admin\Show::init(function (Show $show) {
    
    $show->panel()
        ->tools(function ($tools) {
    
            $tools->disableEdit();
            $tools->disableDelete();
        });
});

//  Remove the import 
\Encore\Admin\Grid::init(function (\Encore\Admin\Grid $grid) {
    
    $grid->disableExport();
});

Single module removal button

//  Remove row selection 
$grid->disableRowSelector();

//  Remove the Add button 
$grid->disableActions();

//  Remove the operation button 
$grid->disableActions();

// Disable the export data button 
$grid->disableExport();

$grid->tools(function ($tools) {
    
    $tools->batch(function ($batch) {
    
        //  Remove batch deletion 
        $batch->disableDelete();
    });
});



Get rid of laravel Model time

	public $timestamps = false;

Add button to header

// 
	$grid->tools(function (Grid\Tools $tools) {
    
	   $tools->append($this->html());
	});

	//  After the current file 
	public function html()
    {
    
        return <<<HTML <a href="/admin/goods" class="btn btn-sm btn-success"> return </a> HTML;
    }

show Model Remove the button

		$show->panel()
            ->tools(function ($tools) {
    
                $tools->disableEdit();
                $tools->disableList();
                $tools->disableDelete();
            });

Sequence of rows

	$grid->number(' Serial number ');
    $grid->rows(function ($row, $number) {
    
        $row->column('number', $number+1);
    });

form The value cannot be modified


	$form->display('column1');
原网站

版权声明
本文为[siner. li]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261004262212.html