Model.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * +----------------------------------------------------------------------
  4. * | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  5. * +----------------------------------------------------------------------
  6. * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  7. * +----------------------------------------------------------------------
  8. * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  9. * +----------------------------------------------------------------------
  10. * | Author: CRMEB Team <admin@crmeb.com>
  11. * +----------------------------------------------------------------------
  12. */
  13. namespace crmeb\services\crud;
  14. /**
  15. * Class Model
  16. * @author 等风来
  17. * @email 136327134@qq.com
  18. * @date 2023/3/13
  19. * @package crmeb\command\crud
  20. */
  21. class Model extends Make
  22. {
  23. /**
  24. * 当前命令名称
  25. * @var string
  26. */
  27. protected $name = "model";
  28. /**
  29. * @return string
  30. * @author 等风来
  31. * @email 136327134@qq.com
  32. * @date 2023/4/4
  33. */
  34. protected function setBaseDir(): string
  35. {
  36. return 'app' . DS . 'model' . DS . 'crud';
  37. }
  38. protected function getFilePathName(string $path, string $name): string
  39. {
  40. $path = ltrim(str_replace('\\', '/', $path), '/');
  41. return $this->getBasePath($path) . $name . '.' . $this->fileMime;
  42. }
  43. /**
  44. * 模板文件
  45. * @param string $type
  46. * @return string
  47. * @author 等风来
  48. * @email 136327134@qq.com
  49. * @date 2023/3/13
  50. */
  51. protected function getStub(string $type = '')
  52. {
  53. return __DIR__ . DS . 'stubs' . DS . 'model' . DS . 'CrudModel.stub';
  54. }
  55. }