HomeController.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Metrics\Examples;
  4. use App\Http\Controllers\Controller;
  5. use Dcat\Admin\Http\Controllers\Dashboard;
  6. use Dcat\Admin\Layout\Column;
  7. use Dcat\Admin\Layout\Content;
  8. use Dcat\Admin\Layout\Row;
  9. use Dcat\Admin\Widgets\Card;
  10. use Dcat\Admin\Widgets\Linkbox;
  11. use Dcat\Admin\Widgets\MediaList;
  12. use Dcat\Admin\Widgets\Callout;
  13. use Dcat\Admin\Widgets\Alert;
  14. use Dcat\Admin\Widgets\ListGroup;
  15. use Dcat\Admin\Widgets\InfoList;
  16. use Dcat\Admin\Widgets\CoverCard;
  17. class HomeController extends Controller
  18. {
  19. public function index(Content $content)
  20. {
  21. $alert = Alert::make('<ul><li><code> Dcat-plus Admin </code> 是基于dcat-admin 的功能增强版,主要是加强两方面,加强灵活的布局; 丰富更多的页面组件。以及修正原有的一些问题。最终做成 汇聚Filament,Laravel-admin , Dcat-admin 优点于一身的基于Laravel + Bootstrap 的极速开发框架。</li><li>灵活的页面布局,丰富的页面组件,精细化的组件控制,多管理面板, 多应用开发场景支持。一键把Model自动生成crud,自带多种js插件,能为您的产品开发节省50%时间。</li><li>Dcatplus 官方 <a href="https://dcat-plus.saishiyun.net/">查看</a></li> <li>快速体验Dcatplus 可安装 [Dcatplus 示例大全] <code> composer require ycookies/dcatplus-demo</code> <a class="copy" data-clipboard-text="composer require ycookies/dcatplus-demo" href="javascript:void(0);"><i class="feather icon-copy"></i></a></li><ul>','Dcat-plus Admin 特色');
  22. $content = $content
  23. ->header('Dcat-plus Admin')
  24. ->description('只为习得《极速开发》神功,实现人身自由,工作自由,财务自由之路')
  25. ->row($alert->info())
  26. ->row(function (Row $row) {
  27. $row->column(6, function (Column $column) {
  28. $column->row(Dashboard::author());
  29. $column->row(new Examples\Tickets());
  30. });
  31. $row->column(6, function (Column $column) {
  32. $group = ListGroup::make();
  33. // 获取已安装扩展包信息
  34. $installedPackages = json_decode(file_get_contents(base_path('vendor/composer/installed.json')), true);
  35. // 指定要获取版本号的扩展包名称
  36. $packageName = 'dcat-plus/laravel-admin';
  37. // 查找指定扩展包的版本号
  38. $packageVersion = '--';
  39. if(!empty($installedPackages['packages'])){
  40. foreach ($installedPackages['packages'] as $package) {
  41. if ($package['name'] === $packageName) {
  42. $packageVersion = $package['version'];
  43. break;
  44. }
  45. }
  46. }
  47. $group->add('Dcat-plus Admin Version', $packageVersion,'#');
  48. $group->add('PHP Version', phpversion(),'#');
  49. $group->add('Laravel Version', app()->version(),'#');
  50. $group->add('Dcat-plus Admin 下载次数', 896,'#');
  51. //$group->add('这是第5个标题', '这是第5个');
  52. $column->row($group->render());
  53. $column->row(function (Row $row) {
  54. $cover_card = CoverCard::make()->add('开源公众号','关注公众号 随时了解更新动态')
  55. ->bg('https://dcat-plus.saishiyun.net/img/card-bg1.jpeg')
  56. ->avatar('https://dcat-plus.saishiyun.net/img/wxgzh_qrcode.jpg');
  57. $row->column(6, $cover_card->render());
  58. $cover_card1 = CoverCard::make()->add('赞助捐助开源','鼓励作者持续更新')
  59. ->bg('https://dcat-plus.saishiyun.net/img/card-bg2.jpeg')
  60. ->avatar('https://dcat-plus.saishiyun.net/img/weixinpay.jpg');
  61. $row->column(6, $cover_card1->render());
  62. $row->column(6, new Examples\NewUsers());
  63. $row->column(6, new Examples\NewDevices());
  64. });
  65. $column->row(new Examples\Sessions());
  66. $column->row(new Examples\ProductOrders());
  67. });
  68. });
  69. return $content;
  70. }
  71. }