Skip to content

Dashboard boxes

Венелин Илиев edited this page Nov 24, 2016 · 7 revisions

How to use?

In module routes.php (app\Modules\ < Module > \Http\routes.php) insert this:

if (\Administration::routeInAdministration()) {
    //administration menu code

    if (\Administration::isDashboard()) {
        //insert box code here
    }
}

Boxes

All boxes methods:

$box->setBoxClass('col-md-3'); //set boostrap column class

Info box

Preview:

info box

Code:

$box = new \ProVision\Administration\Dashboard\InfoBox();
$box->setTitle('Info box');
$box->setValue('90%');
$box->setIconBoxBackgroundClass('bg-red');
$box->setIconClass('fa-american-sign-language-interpreting');
\Dashboard::add($box);

Link box

Preview:

info box

Code:

$box = new \ProVision\Administration\Dashboard\LinkBox();
$box->setTitle('New orders');
$box->setValue('5');
$box->setBoxBackgroundClass('bg-aqua');
$box->setIconClass('fa-shopping-basket');
$box->setLink('View new orders', route('provision.administration.index'));
\Dashboard::add($box);

Html box

$box = new \ProVision\Administration\Dashboard\HtmlBox();
$box->setHtml('your html code here');
\Dashboard::add($box);

Box development

create class where you want and extends DashboardBox:

class YourBox extends DashboardBox {
}

Implement render method who will return box html code:

public function render() {
    return '<div class="' . $this->boxClass . '">your box content here</div>';
}

Add your box in dashboard:

$box = new classNamespace\YourBox();
\Dashboard::add($box);
Clone this wiki locally