Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Using multiple controller for one table
  • Hello everyone !

    I'm trying to create an booking for hotel with FuelPHP.
    There is a table called "booking" created by "oil g admin booking".
    In the admin side all work correctly but now I want to create "_form" in the client side so I've used "oil r fromdb:scaffold bookings" because I want to use the same table as the admin side. But here is the problem, I can't insert any value inside the table in the client side and I think that it just doesn't work. What is the best way to use two controller to interract with one table ?

    Many thanks for everyone who can answer. :)

    PS : I'm new on this forum and FuelPHP so I don't know if I'm doing it in the right way.
  • Harro VertonHarro Verton
    Accepted Answer
    There is a limit to what you can generate, at some point you will have to start coding, the frontend code is, if it can be generated at all, very basic.
  • andersoncdzandersoncdz
    Accepted Answer
    if you will use the same table in many controllers, you just need call the Model wherever you want. Keep in mind that all tables interactions are made by the model.
    For example, i have a project with two modules, admin and site. Inside admin a have a controller called partners, where the crud are performed. In site module(my frontend) when i want list my partners, i call Admin\Model\Partner::find('all'). All you need is call the Booking model in client side and use the the methods to store data in table.

    Ps: I'm using namespace in my project. Forgive me for my bad English (:

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion