Dao.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace crmeb\command;
  12. use think\console\command\Make;
  13. /**
  14. * Class Business
  15. * @package crmeb\command
  16. */
  17. class Dao extends Make
  18. {
  19. protected $type = "Dao";
  20. protected function configure()
  21. {
  22. parent::configure();
  23. $this->setName('make:dao')
  24. ->setDescription('Create a new service class');
  25. }
  26. protected function getStub(): string
  27. {
  28. return __DIR__ . DIRECTORY_SEPARATOR. 'stubs' . DIRECTORY_SEPARATOR . 'dao.stub';
  29. }
  30. protected function getNamespace(string $app): string
  31. {
  32. return parent::getNamespace($app) . '\\dao';
  33. }
  34. protected function getPathName(string $name): string
  35. {
  36. $name = str_replace('app\\', '', $name);
  37. return $this->app->getBasePath() . ltrim(str_replace('\\', '/', $name), '/') . 'Dao.php';
  38. }
  39. }