]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7999 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Feb 2026 11:31:43 +0000 (12:31 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Feb 2026 11:31:43 +0000 (12:31 +0100)
app/Models/ShortLink.php

index 9ca33b6320b2d24548d94afebb5653a567aee1a4..ad9602c459e405cbf730ecb7168d3e0e16321d1e 100644 (file)
@@ -4,16 +4,15 @@ namespace App\Models;
 
 use App\Fields\ShortLinkFluidbooks;
 use App\Models\Base\ToolboxModel;
+use Carbon\Carbon;
 use Cubist\Backpack\CubistBackpackServiceProvider;
 use Cubist\Backpack\Magic\Fields\Hidden;
 use Cubist\Backpack\Magic\Fields\Integer;
 use Cubist\Backpack\Magic\Fields\SelectFromArray;
-use Cubist\Backpack\Magic\Fields\Textarea;
 use Cubist\Backpack\Magic\Fields\URL;
 use Cubist\Backpack\Magic\Traits\CustomDataSource;
 use Cubist\Util\Files\Files;
 use DateTime;
-use Illuminate\Support\Facades\Log;
 
 class ShortLink extends ToolboxModel
 {
@@ -50,6 +49,16 @@ class ShortLink extends ToolboxModel
         $this->addField('target_url', URL::class, __('URL finale'), ['type' => 'hidden_visible', 'column' => true, 'column_view_namespace' => CubistBackpackServiceProvider::NAMESPACE . '::columns', 'column_type' => 'url', 'column_limit' => 40]);
         $this->addField('fluidbook_links', ShortLinkFluidbooks::class, __('PrĂ©sence dans les fluidbooks'), ['column_label' => '<i class="las la-link" title="' . __('Nombre d\'occurence dans les fluidbooks') . '"></i>', 'column' => true]);
         $this->addOwnerField(['column' => false, 'type' => Hidden::class]);
+
+        $this->addFilter('severity', 'dropdown', __('Diagnostic'), function ($value, $crud) {
+            if ($value === 'ok') {
+                $crud->addClause('where', 'http_code', '=', 200);
+            } else if ($value === 'warning') {
+                $crud->addClause('whereBetween', 'http_code', [300, 399]);
+            } else if ($value === 'error') {
+                $crud->addClause('where', 'http_code', '>=', 400);
+            }
+        }, ['ok' => __('Valide'), 'error' => __('Erreur'), 'warning' => __('Avertissement')]);
     }
 
     public function showPrimaryColumn()