mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
Add soft deletes
This commit is contained in:
parent
45e98e0282
commit
0eadab49f1
|
@ -6,11 +6,13 @@ use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Watson\Validating\ValidatingTrait;
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
class ReportTemplate extends Model
|
class ReportTemplate extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
use SoftDeletes;
|
||||||
use ValidatingTrait;
|
use ValidatingTrait;
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
|
|
@ -18,6 +18,7 @@ class CreateReportTemplatesTable extends Migration
|
||||||
$table->integer('created_by')->nullable();
|
$table->integer('created_by')->nullable();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->json('options');
|
$table->json('options');
|
||||||
|
$table->softDeletes();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->index('created_by');
|
$table->index('created_by');
|
||||||
});
|
});
|
||||||
|
|
|
@ -43,7 +43,7 @@ class DeleteReportTemplateTest extends TestCase implements TestsPermissionsRequi
|
||||||
->delete($this->getRoute($reportTemplate))
|
->delete($this->getRoute($reportTemplate))
|
||||||
->assertRedirect(route('reports/custom'));
|
->assertRedirect(route('reports/custom'));
|
||||||
|
|
||||||
$this->assertModelMissing($reportTemplate);
|
$this->assertSoftDeleted($reportTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getRoute(ReportTemplate $reportTemplate): string
|
private function getRoute(ReportTemplate $reportTemplate): string
|
||||||
|
|
Loading…
Reference in a new issue