F
Filament17mo ago
.

help

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'title' in 'field list' how migrate the column
46 Replies
KA
KA17mo ago
Can you post your posts migration?
.
.OP17mo ago
how please?
DrByte
DrByte17mo ago
Did you create and run a migration for the Post model in your Laravel app?
.
.OP17mo ago
yes but when add title no column
BJ
BJ17mo ago
define it in post model protect $fillable
.
.OP17mo ago
how
DrByte
DrByte17mo ago
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
BJ
BJ17mo ago
can u take screenshot for ur post model and ur migration
.
.OP17mo ago
this
BJ
BJ17mo ago
migration?
.
.OP17mo ago
this?
BJ
BJ17mo ago
this model go to migration file
.
.OP17mo ago
sorry
BJ
BJ17mo ago
there is no title here check ur table in db is there title?
.
.OP17mo ago
no
BJ
BJ17mo ago
the table has only id and timestamp for sure will not match u puted values in ur model but it not match with ur current table
.
.OP17mo ago
yah how can add title ?
BJ
BJ17mo ago
make new migration in posts table and put all fields or go direct to db posts table add new row title and check is same error or become slug not found
.
.OP17mo ago
php artisan make:model Post -m like this?
BJ
BJ17mo ago
php artisan make:migration update_posts_table
.
.OP17mo ago
ok
BJ
BJ17mo ago
Schema::table('posts', function (Blueprint $table) { $table->string('title'); }); add slogs too color content same as fillable
.
.OP17mo ago
where
BJ
BJ17mo ago
Schema::table not create u have it already
.
.OP17mo ago
😭
BJ
BJ17mo ago
ضبط؟
.
.OP17mo ago
لا لو احذف المودل وارجعه يضبط؟
BJ
BJ17mo ago
تقدر تحذف الميقرشن والمودل وتحذف الجدول في الداتا بيس وتبنيه من جديد لو تبني ميقريشن اول شي افضل
.
.OP17mo ago
daar
daar17mo ago
Hi Anwar, you need the schema in the migration file, not in the model file
.
.OP17mo ago
this migration can i remove it?
daar
daar17mo ago
GitHub
erpsaas/app/Models/User.php at ec56e8ece6000fbe3faeddf59a7d81a44e72...
Contribute to andrewdwallo/erpsaas development by creating an account on GitHub.
.
.OP17mo ago
هنا
daar
daar17mo ago
notice name in the model file in the array $fillable and the corresponding schema definition : $table->string('name');
BJ
BJ17mo ago
لا احذف الي جوه بنلاقي فيه واحد خاص posts
.
.OP17mo ago
هنا بس ضايفه id
BJ
BJ17mo ago
لا ذا سويه في الميقرش مو موجل احذف الملف وسوي واحد ثاني
.
.OP17mo ago
جالسة احذف الي على جنب
BJ
BJ17mo ago
واحذف الجدول الي في قاعده البيانات الي اسمه post واتشغل مره ثاني عشان يوضح لك
.
.OP17mo ago
بحاول الحين شكرا
BJ
BJ17mo ago
كليك يمين وسوي ديليت وبرضه من قواعد البيانات سوي ميقريشن ثاني وضيفي كل الحقول مو بس id and timestamp add title content any
.
.OP17mo ago
الحين بجرب ان شاءالله
KA
KA17mo ago
@BJ please dont fix him, he will never learn. Let him learn laravel properly. That will help him in future.
BJ
BJ17mo ago
ok my bad im just telling that model has some attributues not iin migration or db table
KA
KA17mo ago
he has no idea about migration or model properly. he might seen some video tutorial and start working without proper learning. you can help him with some good guideline in private.

Did you find this page helpful?