jeudi 19 mai 2016

Change password_resets table column names Laravel 5.2

Is there a way to properly change column names of the password_resets table of the authentication of Laravel 5.2? How to make it work? I'm getting an error in submitting a form when sending a password reset link because I modified the column names. Here's my code:

In ccf_password_resets:

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCcfPasswordResetsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ccf_password_resets', function (Blueprint $table) {
            $table->string('pr_email')->index();
            $table->string('pr_token')->index();
            $table->timestamp('pr_created_at');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('ccf_password_resets');
    }
}

In ccf_users:

<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCcfUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ccf_users', function (Blueprint $table) {
            $table->integer('usr_id')->primary()->unsigned();
            $table->string('usr_first_name');
            $table->string('usr_last_name');
            $table->string('usr_email')->unique();
            $table->string('usr_password');
            $table->integer('usr_role_id')->unsigned();
            $table->boolean('usr_active')->default(0);
            $table->boolean('usr_uses_gravatar')->default(1);
            $table->boolean('usr_receive_email_alerts')->default(1);
            $table->rememberToken();
            $table->timestamp('usr_created_at');
            $table->timestamp('usr_updated_at');

            $table->foreign('usr_role_id')
                ->references('role_id')
                ->on('ccf_roles');
        });

        Schema::table('ccf_users', function (Blueprint $table) {
            $table->renameColumn('remember_token', 'usr_remember_token');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('ccf_users');
    }
}

Now when I submit the form I get this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'email' in 'where clause' (SQL: select * from `ccf_users` where `email` = test@mail.com limit 1)



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TJ1irW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire