F
Filament15mo ago
.

help

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'title' in 'field list' how migrate the column
46 Replies
KA
KA15mo ago
Can you post your posts migration?
.
.OP15mo ago
how please?
DrByte
DrByte15mo ago
Did you create and run a migration for the Post model in your Laravel app?
.
.OP15mo ago
yes but when add title no column
BJ
BJ15mo ago
define it in post model protect $fillable
.
.OP15mo ago
how
DrByte
DrByte15mo 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
BJ15mo ago
can u take screenshot for ur post model and ur migration
.
.OP15mo ago
this
BJ
BJ15mo ago
migration?
.
.OP15mo ago
this?
BJ
BJ15mo ago
this model go to migration file
.
.OP15mo ago
sorry
BJ
BJ15mo ago
there is no title here check ur table in db is there title?
.
.OP15mo ago
no
BJ
BJ15mo 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
.
.OP15mo ago
yah how can add title ?
BJ
BJ15mo 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
.
.OP15mo ago
php artisan make:model Post -m like this?
BJ
BJ15mo ago
php artisan make:migration update_posts_table
.
.OP15mo ago
ok
BJ
BJ15mo ago
Schema::table('posts', function (Blueprint $table) { $table->string('title'); }); add slogs too color content same as fillable
.
.OP15mo ago
where
BJ
BJ15mo ago
Schema::table not create u have it already
.
.OP15mo ago
😭
BJ
BJ15mo ago
ضبط؟
.
.OP15mo ago
لا لو احذف المودل وارجعه يضبط؟
BJ
BJ15mo ago
تقدر تحذف الميقرشن والمودل وتحذف الجدول في الداتا بيس وتبنيه من جديد لو تبني ميقريشن اول شي افضل
.
.OP15mo ago
daar
daar15mo ago
Hi Anwar, you need the schema in the migration file, not in the model file
.
.OP15mo ago
this migration can i remove it?
daar
daar15mo ago
GitHub
erpsaas/app/Models/User.php at ec56e8ece6000fbe3faeddf59a7d81a44e72...
Contribute to andrewdwallo/erpsaas development by creating an account on GitHub.
.
.OP15mo ago
هنا
daar
daar15mo ago
notice name in the model file in the array $fillable and the corresponding schema definition : $table->string('name');
BJ
BJ15mo ago
لا احذف الي جوه بنلاقي فيه واحد خاص posts
.
.OP15mo ago
هنا بس ضايفه id
BJ
BJ15mo ago
لا ذا سويه في الميقرش مو موجل احذف الملف وسوي واحد ثاني
.
.OP15mo ago
جالسة احذف الي على جنب
BJ
BJ15mo ago
واحذف الجدول الي في قاعده البيانات الي اسمه post واتشغل مره ثاني عشان يوضح لك
.
.OP15mo ago
بحاول الحين شكرا
BJ
BJ15mo ago
كليك يمين وسوي ديليت وبرضه من قواعد البيانات سوي ميقريشن ثاني وضيفي كل الحقول مو بس id and timestamp add title content any
.
.OP15mo ago
الحين بجرب ان شاءالله
KA
KA15mo ago
@BJ please dont fix him, he will never learn. Let him learn laravel properly. That will help him in future.
BJ
BJ15mo ago
ok my bad im just telling that model has some attributues not iin migration or db table
KA
KA15mo 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?