Answer the question
In order to leave comments, you need to log in
How to populate the default table when creating migrations?
I'm creating a migration of categories and subcategories.
public function up()
{
Schema::create('categories', function (Blueprint $table) {
$table->increments('id');
$table->char('category_name', 100);
$table->char('title_in_english', 100); //для того, что бы вывести все посты главной категории
});
}
public function up()
{
Schema::create('sub_categories', function (Blueprint $table) {
$table->increments('id');
$table->char('sub_category_name', 100);
$table->integer('id_category');
});
}
category_name = Изображения
title_in_english = images
category_name = Видео
title_in_english = videos
sub_category_name = Автомобили
id_category = 1
sub_category_name = Дом
id_category = 2
Answer the question
In order to leave comments, you need to log in
Directly in the migration and add them. Through the model , through the factory or through direct requests - whatever.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question