haythem/progress-bar

一个Laravel Nova的字段。

v2.0.3 2024-07-24 09:06 UTC

This package is auto-updated.

Last update: 2024-09-24 09:36:31 UTC


README

Packagist Packagist

包描述:为laravel nova动态进度条字段

安装

通过composer安装

composer require haythem/progress-bar

设置路由

Route::get('/progressbar', function () {
    return ["percentage" => rand(0, 100), "show" => true];
});

使用

    use Haythem\ProgressBar\ProgressBar;

    public function fields(Request $request)
    {
     return [
            ProgressBar::make('Progress Bar')
                ->endPoint('/api/progress')
                ->callEvery(500)
                ->markAsDone(false)
                ->barColor("#FFC0CB")
                ->barBackgroundColor("yellow")
                ->textColor('pink')
                ->initLabel("please wait")
                ->processingLabel("processing")
                ->doneLabel("all is good")
                ->redirectWhenItsDone("https://www.google.com",true)  //second parameter is optional to open the url in new tab or in the same tab.
                ->reloadWhenItsDone()
                ->showProgressBarInForms(true) // you can show progress bar in forms.
                ->animation(),//show three dots animation when initializing and processing.
    ];
    }