A free open source IT asset/license management system
Re-introduce soft deletes
Marcus Moore363ec841d1f9
diff --git a/app/Models/ReportTemplate.php b/app/Models/ReportTemplate.phpindex d1a00c5657..90b83cba54 100644--- a/app/Models/ReportTemplate.php+++ b/app/Models/ReportTemplate.php@@ -6,11 +6,13 @@ use Illuminate\Database\Eloquent\Builder;use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\Relations\BelongsTo;+use Illuminate\Database\Eloquent\SoftDeletes;use Watson\Validating\ValidatingTrait;class ReportTemplate extends Model{use HasFactory;+ use SoftDeletes;use ValidatingTrait;protected $casts = [diff --git a/database/migrations/2023_08_23_232739_create_report_templates_table.php b/database/migrations/2023_08_23_232739_create_report_templates_table.phpindex 0ca44f0070..d9438f2cc8 100644--- a/database/migrations/2023_08_23_232739_create_report_templates_table.php+++ b/database/migrations/2023_08_23_232739_create_report_templates_table.php@@ -18,6 +18,7 @@ class CreateReportTemplatesTable extends Migration$table->integer('created_by')->nullable();$table->string('name');$table->json('options');+ $table->softDeletes();$table->timestamps();$table->index('created_by');});diff --git a/tests/Feature/ReportTemplates/DeleteReportTemplateTest.php b/tests/Feature/ReportTemplates/DeleteReportTemplateTest.phpindex e77942256f..52f4ad888d 100644--- a/tests/Feature/ReportTemplates/DeleteReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/DeleteReportTemplateTest.php@@ -42,7 +42,7 @@ class DeleteReportTemplateTest extends TestCase implements TestsPermissionsRequi->delete($this->getRoute($reportTemplate))->assertRedirect(route('reports/custom'));- $this->assertModelMissing($reportTemplate);+ $this->assertSoftDeleted($reportTemplate);}private function getRoute(ReportTemplate $reportTemplate): string