Skip to content

Commit 0eadab4

Browse files
committed
Add soft deletes
1 parent 45e98e0 commit 0eadab4

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

app/Models/ReportTemplate.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
use Illuminate\Database\Eloquent\Factories\HasFactory;
77
use Illuminate\Database\Eloquent\Model;
88
use Illuminate\Database\Eloquent\Relations\BelongsTo;
9+
use Illuminate\Database\Eloquent\SoftDeletes;
910
use Watson\Validating\ValidatingTrait;
1011

1112
class ReportTemplate extends Model
1213
{
1314
use HasFactory;
15+
use SoftDeletes;
1416
use ValidatingTrait;
1517

1618
protected $casts = [

database/migrations/2023_08_23_232739_create_report_templates_table.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function up()
1818
$table->integer('created_by')->nullable();
1919
$table->string('name');
2020
$table->json('options');
21+
$table->softDeletes();
2122
$table->timestamps();
2223
$table->index('created_by');
2324
});

tests/Feature/ReportTemplates/DeleteReportTemplateTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testCanDeleteAReportTemplate()
4343
->delete($this->getRoute($reportTemplate))
4444
->assertRedirect(route('reports/custom'));
4545

46-
$this->assertModelMissing($reportTemplate);
46+
$this->assertSoftDeleted($reportTemplate);
4747
}
4848

4949
private function getRoute(ReportTemplate $reportTemplate): string

0 commit comments

Comments
 (0)