How could I use one route with git for multiple developers in Laravel 4.2

放肆的年华 提交于 2019-12-11 03:12:30

问题


I have only one routes app/routes.php, I am using git /git-hub for sharing my projects with some developers. Cause they can work together. But problem is that : every one using same routes.php file for routing and when they push/pull in git this routes.php file conflicts all the time.

Is there any way to set routes for different developer in same project ?


回答1:


There is a silly way but fruitful::

  1. create routes_demo.php :: here demo developer can work
  2. Include routes_demo.php in your main routes.php

include more as your need. Enjoy sharing codes /projects.

THanks




回答2:


This is what Github is all about - collaboration between multiple developers.

There are many ways to handle this - but in general each developer can fork his own branch - make changes - then merge them back in.

You will expect conflicts on the file - but the conflicts should not be the same route - it should be different routes in the same file - so you can merge the conflict into the one route file




回答3:


I suggest you use controllers to define routing logic, so your routes.php file does not get complicated. You will avoid a lot of conflicts this way. You can read more here. Pasting an excerpt:

Instead of defining all of your route-level logic in a single routes.php file, you may wish to organize this behavior using Controller classes. Controllers can group related route logic into a class, as well as take advantage of more advanced framework features such as automatic dependency injection.



来源:https://stackoverflow.com/questions/27522551/how-could-i-use-one-route-with-git-for-multiple-developers-in-laravel-4-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!