Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Fast way to do a simple app
  • Hi,

       I'm new to FuelPHP, (not new in PHP programming)  Since now I like very much it, the clean siyntax and organization
    Now, I'd like to know what is the best/fast way to do a simple task like this:

    1) 2 table in a DB: first table is a user and pass table (for auth), second table "todo" is a todo list with a relation with first table (field only userID and task).
    2) create an app with Auth Login for ALL page (if you are not registered you cannot do nothing)
    3) CRUD operation for table "todo" obviously related to the username.

    STOP.

    I'd like to know what is the most convenient way to do this with less manualy code but with a large use of oil command.

    Someone can answer?

    Best regards.


  • There is no way to generate complex code at the moment, so you'll have to code the dropdown for users manually, which should not take more than 5 minutes.

    For the rest:

    1. Install FuelPHP
    2. Copy the auth.php config file from the Auth package to app/config
    3. Modify that config file to select Simpleauth or Ormauth, define the salt, and other parameters
    4. Add the Auth package to the always_load section of app/config/config.php
    5. Configure app/config/development/db.php with your DB information (driver, user, database, etc)
    6. Run "oil generate admin todo id:int users_id:int task:text" to generate the crud for the Todo table
    7. Run "oil refine migrate --all" to create the Auth tables and the Todo table
    8. Optionally run "oil refine fromdb:scaffold -a users" to generate the admin pages for the Auth users table

    This will generate a normal input field for "users_id". You need to replace that with a Form::select() to create a dropdown for the users.

    And in your controller method you need to run a query using the generated User model to fetch the users id and name, and store those in an array. Pass the array to the view so it can be passed in there to the Form::select().

    DONE.

    That's it.

Howdy, Stranger!

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

In this Discussion