haythem/progress-bar

A Laravel Nova field.

v2.0.2 2023-03-01 10:44 UTC

This package is auto-updated.

Last update: 2024-04-07 11:38:41 UTC


README

Packagist Packagist

Package Description: A dynamic progress bar field for laravel nova

Installation

Install via composer

composer require haythem/progress-bar

Setup route

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

Usage

    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()
                ->animation(),//show three dots animation when initializing and processing
    ];
    }