douduiyun6125 2016-02-25 21:23
浏览 77
已采纳

Laravel自定义界面放置

I am making a blog with laravel and here, users can subscribe for newsletters. The thing is I am planning to use mailchimp and I need to make all the necessary interfaces, classes and service providers. After watching laracasts take on this, they put all the files in app\Acme\Newsletters and app\Acme\Notify. But that was in Laravel 4. Now there are separate folders for providers. So should place interfaces and classes in app\Blog\Newsletters and service providers in their dedicated folder, or all in one? And since in the autoload there is already a psr-4 directory defined

psr-4 : {"App\\" : "app/"}

I do not need to edit the autoload, since the Blog directory is inside the app/?

  • 写回答

1条回答 默认 最新

  • doudi4621 2016-02-25 21:55
    关注

    It is your own decision where to place your classes and interfaces as laravel uses psr-4 autoloading. You only need to pay attention to your namespace usage. If you want to place your classes within app\Blog\Newsletters you must namespace them with \App\Blog\Newsletters. As services providers are registered within config\app.php you are also free to place them everywhere you want. Laravel resolves this for you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭