Это таблица расходов
Код: Выделить всё
public function up(): void
{
Schema::create('expenses', function (Blueprint $table) {
$table->id();
$table->increments('category_id');
$table->foreign('category_id')->references('id')
->on(table:'categories')->onDelete('cascade')->onUpdate(action:'cascade');
$table->decimal('amount',8, 2);
$table->date('entry_date');
$table->timestamps();
$table->engine = 'InnoDB';
});
}
Код: Выделить всё
public function up(): void
{
Schema::create('categories', function (Blueprint $table) {
$table->increments('id');
$table->string('category_name');
$table->string('description')->nullable();
$table->timestamps();
});
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... tly-formed