Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jhansi's avatar

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Date' in 'field list'

migration table

<?php

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

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->date('Date');
            $table->string('Project');
            $table->integer('TicketNumber');
            $table->Text('TicketSubject');
            $table->Time('Timein');
            $table->Time('Timeout');
                        
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }
}
0 likes
6 replies
cent040's avatar

In Model User.php

 protected $fillable = [
          'first_name', 'email', 'password','Date',
 ];

Add Date in fillable in User Model

Regards Arfan

jhansi's avatar

protected $fillable = [ 'Date','Project','TicketNumber','TicketSubject','Timein','Timeout', ];

I wrote it

Sirik's avatar

I think it's not a good idea to use reserved words in your model, i should give is a better designation

cent040's avatar

@jhansi are you still getting the issue after adding. ?

@Sirik If this is not a good idea. What's good please wrote here..

Regards Arfan

Sirik's avatar

@cent040 I would describe what it means, for example if it's only to register a ticket i won't use the Users table because it's part of the Core functionality of Laravel, i would create a "hasMany" relation to "Tickets" and use "$table->timestamps(); " for the created and updated and not using "Date"

Snapey's avatar

Obviously I don't know what you are building but why do you have a specific ticket number and description in a user model?

What @Sirik is saying, don't use 'Date' as a column name since there is a php function called date so thus should be reserved for php .

Just think of a different name. Date of what? date of ticket? then call it that 'ticketDate'

1 like

Please or to participate in this conversation.