diff --git a/app/Models/Budget.php b/app/Models/Budget.php new file mode 100644 index 0000000..5ffff5a --- /dev/null +++ b/app/Models/Budget.php @@ -0,0 +1,20 @@ +id(); + $table->string('name')->nullable(); + $table->string('description')->nullable(); + $table->decimal('default_budget', 12, 2)->default(0); $table->timestamps(); $table->softDeletes(); }); diff --git a/database/migrations/2021_12_13_035122_create_transaction_table.php b/database/migrations/2021_12_13_035122_create_transaction_table.php new file mode 100644 index 0000000..6478ce8 --- /dev/null +++ b/database/migrations/2021_12_13_035122_create_transaction_table.php @@ -0,0 +1,38 @@ +id(); + $table->foreignId('category_id')->references('id')->on('categories')->nullable(); + $table->date('date')->nullable(); + $table->decimal('amount', 12, 2)->default(0); + $table->string('description'); + $table->smallInteger('is_income')->default(0); // 0 expense, 1 income + $table->smallInteger('income_type')->nullable(); // 0 is cash in , 1 is cash out + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('transactions'); + } +} diff --git a/database/migrations/2021_12_13_035435_create_budget_table.php b/database/migrations/2021_12_13_035435_create_budget_table.php new file mode 100644 index 0000000..c42b6bc --- /dev/null +++ b/database/migrations/2021_12_13_035435_create_budget_table.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId('category_id')->nullable(); + $table->decimal('rollover', 12, 2)->default(0); + $table->decimal('budget', 12, 2)->default(0); + $table->date('start_date')->nullable(); + $table->date('end_date')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('budgets'); + } +}