Number1.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace UCore\DcatAdmin\Metrics\Examples;
  3. use Dcat\Admin\Widgets\Metrics\Card;
  4. use Dcat\Admin\Widgets\Metrics\RadialBar;
  5. use Illuminate\Http\Request;
  6. /**
  7. * 统计卡片:就一个标题+数字
  8. */
  9. class Number1 extends Card
  10. {
  11. protected $height = 140;
  12. protected $title ='一个数字';
  13. public function __construct($title=null, $icon = null)
  14. {
  15. if($title){
  16. $this->title($title);
  17. }
  18. if($icon){
  19. $this->icon($icon);
  20. }
  21. if ($options = $this->defaultChartOptions()) {
  22. $this->chartOptions = $options;
  23. }
  24. $this->init();
  25. }
  26. /**
  27. * 处理请求
  28. *
  29. * @param Request $request
  30. *
  31. * @return mixed|void
  32. */
  33. public function handle(Request $request)
  34. {
  35. $this->withContent(162);
  36. }
  37. /**
  38. * 卡片内容
  39. *
  40. * @param string $content
  41. *
  42. * @return $this
  43. */
  44. public function withContent($content)
  45. {
  46. return $this->content(
  47. <<<HTML
  48. <div class="d-flex flex-column flex-wrap text-center">
  49. <h1 class="font-lg-1 mt-2 mb-0">{$content}</h1>
  50. </div>
  51. HTML
  52. );
  53. }
  54. }