<?php

namespace App\Admin\Extensions;

class CleanCache
{

    public function __toString()
    {
        $url = route('admin.cleanCache');

        return <<<HTML
<li data-toggle="tooltip" data-placement="bottom" title="清除缓存">
    <a href="javascript:void(0);" class="clean-cache">
      <i class="fa fa-trash-o"></i>
    </a>
</li>

<script>
$('.clean-cache').click(function () {
    $.get('{$url}', function (data) {
        toastr.success(data)
    })
})
</script>
HTML;
    }

}