Enable soft-deleting for earnings/spendings
MODIFY
app/Earning.php
app/Earning.php
namespace App;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\SoftDeletes;
class Earning extends Model {
+ use SoftDeletes;
+
+ protected $dates = ['deleted_at'];
+
// Accessors
public function getFormattedAmountAttribute() {
return number_format($this->amount / 100, 2);

MODIFY
app/Spending.php
app/Spending.php
namespace App;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\SoftDeletes;
class Spending extends Model {
+ use SoftDeletes;
+
+ protected $dates = ['deleted_at'];
+
// Accessors
public function getFormattedAmountAttribute() {
return number_format($this->amount / 100, 2);

MODIFY
database/migrations/2017_07_23_111013_create_spendings_table.php
database/migrations/2017_07_23_111013_create_spendings_table.php
@@ -14,6 +14,7 @@ class CreateSpendingsTable extends Migration {
$table->string('description');
$table->integer('amount');
$table->timestamps();
+ $table->softDeletes();
});
}

MODIFY
database/migrations/2017_07_23_112354_create_earnings_table.php
database/migrations/2017_07_23_112354_create_earnings_table.php
@@ -13,6 +13,7 @@ class CreateEarningsTable extends Migration {
$table->string('description');
$table->integer('amount');
$table->timestamps();
+ $table->softDeletes();
});
}

Enable soft-deleting for earnings/spendings