链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
930 B

5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Metrics\Examples\Community;
  3. use App\Models\LanzuUserRelationBind;
  4. use Dcat\Admin\Admin;
  5. use Dcat\Admin\Widgets\Metrics\Card;
  6. class TotalUser extends Card
  7. {
  8. public function __construct($title = null, $icon = null)
  9. {
  10. parent::__construct($title, $icon);
  11. }
  12. protected function init()
  13. {
  14. parent::init();
  15. $this->title = '绑定人数';
  16. $adu = Admin::user();
  17. if ($adu->isRole('lanzu_cs')){
  18. $this->content(LanzuUserRelationBind::getCount($adu->id));
  19. }else{
  20. $this->content(LanzuUserRelationBind::getCount());
  21. }
  22. }
  23. public function renderContent()
  24. {
  25. $content = parent::renderContent();
  26. return <<<HTML
  27. <div class="d-flex justify-content-between bg-primary align-items-center mt-1" style="margin-bottom: 2px">
  28. <h2 class="ml-1 font-large-1">{$content}</h2>
  29. </div>
  30. HTML;
  31. }
  32. }