php artisan make:migration create_comments_table --create=comments
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCommentsTable extends Migration
{
public function up()
{
Schema::create('comments', function (Blueprint $table) {
$table->id();
$table->text('content');
$table->morphs('commentable'); // Polymorphic columns: commentable_id and commentable_type
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('comments');
}
}