DEV Community

Discussion on: Laravel 8 CRUD App, A simple guide

Collapse
 
ann143 profile image
Ann143

When I run the project, this was the result "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into projects (name, introduction, location, cost, updated_at, created_at) values (Apple, This is fruit., Cebu, 10, 2021-05-05 01:49:18, 2021-05-05 01:49:18))". What is the problem of this? I am beginner with Laravel.

Collapse
 
nannim profile image
Nannim

could you review your ProjectsController, projects table in the database and Projects model to make sure you are not missing an entity that may be offsetting the sequence of items to be entered into the database from the form? else

it appears that within your database, you need to ensure that you have a projects table, you can delete it and create it again using

php artisan make:migration create_projects_table

this will create a table in your database/migrations directory,
Laravel will do this by default containing the updated_at, created at
make sure there's also an Id attribute
making three attributes in the create_projects_table (supposedly by default) file then you can add the name, introduction, location and cost
next you need to run

php artisan migrate

it should work now