From e870eafdc3dbd8d878b1f878712b873b0229b44f Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 18 Nov 2025 19:33:23 +0100 Subject: [PATCH] #7818 @1 --- app/Models/FluidbookAuditLink.php | 30 +++++++++----- ..._17_184637_create_fluidbook_audit_link.php | 39 ------------------- 2 files changed, 20 insertions(+), 49 deletions(-) delete mode 100644 database/migrations/2025_11_17_184637_create_fluidbook_audit_link.php diff --git a/app/Models/FluidbookAuditLink.php b/app/Models/FluidbookAuditLink.php index 650343466..d71d1234d 100644 --- a/app/Models/FluidbookAuditLink.php +++ b/app/Models/FluidbookAuditLink.php @@ -2,20 +2,14 @@ namespace App\Models; -use App\Models\Base\ToolboxDownloadable; -use App\Models\Base\ToolboxModel; -use App\Models\Traits\CheckHash; +use Cubist\Backpack\Magic\Fields\Datetime; use Cubist\Backpack\Magic\Fields\Integer; use Cubist\Backpack\Magic\Fields\Text; -use App\Http\Controllers\Admin\Operations\ChangeownerOperation; -use App\Http\Controllers\Admin\Operations\ChangestatusOperation; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Routing\Route; +use Cubist\Backpack\Magic\Fields\URL; +use Cubist\Backpack\Magic\Models\CubistMagicAbstractModel; -class FluidbookAuditLink extends Model +class FluidbookAuditLink extends CubistMagicAbstractModel { - use CheckHash; - use ToolboxDownloadable; protected $table = 'fluidbook_audit_link'; protected $_options = ['name' => 'fluidbook-audit_link', @@ -23,4 +17,20 @@ class FluidbookAuditLink extends Model 'plural' => 'auditlinks']; protected static $_permissionBase = 'fluidbook-collection'; + + + public function setFields() + { + parent::setFields(); + $this->addField('fluidbook_id', Integer::class, 'Fluidbook ID'); + $this->addField('page', Integer::class, 'Fluidbook ID'); + $this->addField('link_id', Text::class, 'Link ID'); + $this->addField('http_code', Integer::class, 'HTTP Code'); + $this->addField('code_date', Datetime::class); + $this->addField('url', URL::class); + $this->addField('target_code', Integer::class); + $this->addField('target_url', URL::class); + + $this->addUniqueKey(['fluidbook_id', 'link_id']); + } } diff --git a/database/migrations/2025_11_17_184637_create_fluidbook_audit_link.php b/database/migrations/2025_11_17_184637_create_fluidbook_audit_link.php deleted file mode 100644 index 8480d26de..000000000 --- a/database/migrations/2025_11_17_184637_create_fluidbook_audit_link.php +++ /dev/null @@ -1,39 +0,0 @@ -id(); - $table->integer('fluidbook_id'); - $table->integer('page'); - $table->string('link_id'); - $table->string('error_code')->nullable(); - $table->string('first_time_error')->nullable(); - $table->string('last_date_test')->nullable(); - $table->string('url'); - $table->string('new_url')->nullable(); - $table->string('redirection_code')->nullable(); - $table->string('final_code_url')->nullable(); - $table->string('final_target')->nullable(); - $table->unique(['link_id', 'fluidbook_id']); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('fluidbook_audit_link'); - } -}; -- 2.39.5