dongmo9996 2019-01-18 15:08
浏览 86

laravel流明包中的动态模型命名空间

I am building a laravel lumen package. In the package there is a service provider which uses instance of User model in a function. I used App\User as namespace there.

Now, If actual User Model is placed in different namespace eg. App\Models\User my package gives an error of undefined class User.

How can I get this User model instance in proper way without any error?

  • 写回答

1条回答 默认 最新

  • dswqz24846 2019-01-18 15:13
    关注

    You could get the User model location from the config/auth.php. However if the application uses a different authentication method, this will not work.

    I think your best option is to make the class path to the User model configurable.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?