Monday, December 31, 2012

FuelPHP 3. Using Auth Package

Auth


1. Config


    Add auth to always_load array

        return array(

            'default_timezone'   => 'Asia/Seoul',

            'always_load'  => array(
                    'packages'  => array(
                     'orm',
                     'auth',
                  ),
            ),
        );

2. DB Table Name

    Notice the table name should be 'users' by looking at the file J:/fuel/packages/auth/config/simpleauth.php


/**
     * DB table name for the user table
     */
'table_name' => 'users',

3. Create DB Table by using oil

        php oil g model user username:string password:string group:int email:string last_login:string login_hash:string profile_fields:string

    Those fields are as shown in the simpleauth.php

    And then perform migration

        php oil r migrate


4. Create a controller

    php oil g controller users login logout register




No comments:

Post a Comment