is there a migration for USER?

Issue #11 closed
Former user created an issue

just started using this component.

i was wondering is there a sample or code on USER table?

thanks

Comments (4)

  1. David Oshiro

    As far as I know, Laravel 4 by default has the User model but no migration for the users table. It is easy enough to create your own migration for a users table. My user table contains username, password and email.

  2. Tim Osborn

    I was wondering this, too!

    There was a bit of trial and error getting this right for me - I didn't change the defaults in the db.php config, and ended up just adding fields (and fillable) until anvard was happy. So I needed:

    <?php
    
    use Illuminate\Database\Migrations\Migration;
    
    class CreateUsersTable extends Migration {
    
        /**
         * Run the migrations.
         *
         * @return void
         */
        public function up()
        {
            Schema::create('users', function($table)
            {
                $table->increments('id');
                $table->string('username');
                $table->string('role_id');
                $table->string('email')->unique();
                $table->string('password');
                $table->string('password_confirmation');
                $table->timestamps();
            });
        }
    
        /**
         * Reverse the migrations.
         *
         * @return void
         */
        public function down()
        {
            Schema::dropIfExists('users');
        }
    
    }
    

    I'm look forward to comprehending the subtleties!

  3. Log in to comment