Rename type column in recurrings table to interval
MODIFY
app/Http/Controllers/RecurringController.php
app/Http/Controllers/RecurringController.php
@@ -47,7 +47,7 @@ class RecurringController extends Controller {
$recurring = new Recurring;
$recurring->space_id = session('space')->id;
- $recurring->type = 'monthly';
+ $recurring->interval = 'monthly';
$recurring->day = ltrim($request->input('day'), '0');
$recurring->starts_on = date('Y-m-d');
$recurring->ends_on = $request->input('end');

MODIFY
app/Jobs/ProcessRecurrings.php
app/Jobs/ProcessRecurrings.php
@@ -21,7 +21,7 @@ class ProcessRecurrings implements ShouldQueue {
$day = (int) date('j');
$recurrings = Recurring
- ::where('type', 'monthly')
+ ::where('interval', 'monthly')
->when((int) date('t') == $day,
function ($query) use ($day) {
return $query->where('day', '>=', $day);

MODIFY
database/factories/ModelFactory.php
database/factories/ModelFactory.php
@@ -49,7 +49,7 @@ $factory->define(Spending::class, function (Generator $faker) {
$factory->define(Recurring::class, function (Generator $faker) {
return [
- 'type' => 'monthly',
+ 'interval' => 'monthly',
'day' => $faker->numberBetween(1, 28),
'starts_on' => $faker->dateTimeBetween('-50 days', 'now')->format('Y-m-d'),
'description' => implode(' ', array_map('ucfirst', $faker->words(3))),

ADD
database/migrations/2020_06_05_160120_rename_type_column_to_interval_in_recurrings_table.php
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class RenameTypeColumnToIntervalInRecurringsTable extends Migration
+{
+ public function up(): void
+ {
+ Schema::table('recurrings', function (Blueprint $table) {
+ $table->renameColumn('type', 'interval');
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::table('recurrings', function (Blueprint $table) {
+ $table->renameColumn('interval', 'type');
+ });
+ }
+}

Rename type column in recurrings table to interval