From 43fefec37aa14b5af4b18d80d3d06db8e90ff0d4 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Thu, 14 Jun 2018 21:16:05 +0100 Subject: [PATCH 1/2] Schedules should be soft deletable --- app/Models/Schedule.php | 3 +- ...06_14_201440_AlterSchedulesSoftDeletes.php | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2018_06_14_201440_AlterSchedulesSoftDeletes.php diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index 6202952baf31..42442363e90e 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -18,6 +18,7 @@ use Carbon\Carbon; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\SoftDeletes; use McCool\LaravelAutoPresenter\HasPresenter; /** @@ -27,7 +28,7 @@ */ class Schedule extends Model implements HasPresenter { - use SearchableTrait, SortableTrait, ValidatingTrait; + use SearchableTrait, SoftDeletes, SortableTrait, ValidatingTrait; /** * The upcoming status. diff --git a/database/migrations/2018_06_14_201440_AlterSchedulesSoftDeletes.php b/database/migrations/2018_06_14_201440_AlterSchedulesSoftDeletes.php new file mode 100644 index 000000000000..1cd00417d9a6 --- /dev/null +++ b/database/migrations/2018_06_14_201440_AlterSchedulesSoftDeletes.php @@ -0,0 +1,41 @@ +softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('schedules', function (Blueprint $table) { + $table->dropSoftDeletes(); + }); + } +} From 03dab3667e7024c7a4b014e9d5c2bb000e995a50 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Thu, 14 Jun 2018 20:16:19 +0000 Subject: [PATCH 2/2] Apply fixes from StyleCI [ci skip] [skip ci] --- .../2018_06_14_201440_AlterSchedulesSoftDeletes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2018_06_14_201440_AlterSchedulesSoftDeletes.php b/database/migrations/2018_06_14_201440_AlterSchedulesSoftDeletes.php index 1cd00417d9a6..fb802abaaafd 100644 --- a/database/migrations/2018_06_14_201440_AlterSchedulesSoftDeletes.php +++ b/database/migrations/2018_06_14_201440_AlterSchedulesSoftDeletes.php @@ -9,9 +9,9 @@ * file that was distributed with this source code. */ -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; class AlterSchedulesSoftDeletes extends Migration {