Add soft deletes

This commit is contained in:
Marcus Moore 2024-10-29 15:26:18 -07:00
parent 45e98e0282
commit 0eadab49f1
No known key found for this signature in database
3 changed files with 4 additions and 1 deletions

View file

@ -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 = [

View file

@ -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');
});

View file

@ -43,7 +43,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