S
S
SuperDoker2017-09-30 15:13:49
Laravel
SuperDoker, 2017-09-30 15:13:49

What is the best way to do this in laravel?

I have a game, now it is made in the form of a controller. It accepts api requests and returns data. The game has some settings (time, number of rounds), now they are in the config. And now I need to make 5 more different types of this game, that is, all the functionality is preserved, but only the settings and, accordingly, the paths for the API change. So what is the best way to organize it now?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
oh, 2017-09-30
well @AnneSmith

same config

D
dskozin, 2017-10-02
@dskozin

You can create a settings class (singleton), register it in the Lara container and, depending on which game, create a settings object with your data. Use this object in controllers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question