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

RefreshButton   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 22 1
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
}