php - i'm noobie need help xD i have error in sql but i dont know where. laravel 7
one text
Solution:
The problem is in your user table migration.
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('firstname');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('name');
$table->date('created_at');
$table->string('address');
$table->string('city');
$table->string('zipcode');
$table->string('gender');
$table->integer('number')->unique();
$table->date('birthday');
$table->string('pseudo')->unique();
$table->rememberToken();
$table->timestamps();
});
}
You are trying to create a column $table->date('created_at');
but you also have $table->timestamps();
. That is also trying to create a column called created_at
. One of these should be removed.
If you do remove the $table->timestamps();
you won't have an updated_at
column and your model will need updating with:
public $timestamps = false;
Updated User Model
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use Notifiable;
public $timestamps = false;
// Rest of your model
......
One final thing, in your down
function of the migration your dropping the table and then have $table->dropColumn('gender');
. This may cause an issue as you've already dropped the whole table, thus already dropping the gender
column.