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