Completed
Push — master ( bb30ab...2ca19a )
by Song
02:37
created

RefreshButton::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 22
rs 9.568
c 0
b 0
f 0
1
<?php
2
3
namespace Encore\Admin\Widgets\Navbar;
4
5
use Encore\Admin\Admin;
6
use Illuminate\Contracts\Support\Renderable;
7
8
class RefreshButton implements Renderable
9
{
10
    public function render()
11
    {
12
        $message = __('admin.refresh_succeeded');
13
14
        $script = <<<SCRIPT
15
$('.container-refresh').off('click').on('click', function() {
16
    $.admin.reload();
17
    $.admin.toastr.success('{$message}', '', {positionClass:"toast-top-center"});
18
});
19
SCRIPT;
20
21
        Admin::script($script);
22
23
        return <<<EOT
24
<li>
25
    <a href="javascript:void(0);" class="container-refresh">
26
      <i class="fa fa-refresh"></i>
27
    </a>
28
</li>
29
EOT;
30
31
    }
32
}