How could I use one route with git for multiple de

2019-07-16 14:37发布

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 ?

3条回答
别忘想泡老子
2楼-- · 2019-07-16 15:04

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.

查看更多
倾城 Initia
3楼-- · 2019-07-16 15:11

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

查看更多
Evening l夕情丶
4楼-- · 2019-07-16 15:12

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

查看更多
登录 后发表回答