Number.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. class Number extends Card
  7. {
  8. protected $height = 140;
  9. protected $title ='Number';
  10. public function __construct($title = null, $icon = null)
  11. {
  12. if($title){
  13. $this->title($title);
  14. }
  15. if($icon){
  16. $this->icon($icon);
  17. }
  18. if ($options = $this->defaultChartOptions()) {
  19. $this->chartOptions = $options;
  20. }
  21. $this->init();
  22. }
  23. /**
  24. * 处理请求
  25. *
  26. * @param Request $request
  27. *
  28. * @return mixed|void
  29. */
  30. public function handle(Request $request)
  31. {
  32. $this->withContent(162);
  33. }
  34. /**
  35. * 卡片内容
  36. *
  37. * @param string $content
  38. *
  39. * @return $this
  40. */
  41. public function withContent($content)
  42. {
  43. return $this->content(
  44. <<<HTML
  45. <div class="d-flex flex-column flex-wrap text-center">
  46. <h1 class="font-lg-2 mt-2 mb-0">{$content}</h1>
  47. </div>
  48. HTML
  49. );
  50. }
  51. }