]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7821 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 21 Nov 2025 19:01:01 +0000 (20:01 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 21 Nov 2025 19:01:01 +0000 (20:01 +0100)
app/Console/Commands/HemsleyAuditCollection.php [new file with mode: 0644]
app/Console/Kernel.php

diff --git a/app/Console/Commands/HemsleyAuditCollection.php b/app/Console/Commands/HemsleyAuditCollection.php
new file mode 100644 (file)
index 0000000..f4a5d41
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Console\Commands\Base\ToolboxCommand;
+
+class HemsleyAuditCollection extends ToolboxCommand
+{
+    protected $signature = 'hemsleyfraser:auditcollection';
+
+    public function handle()
+    {
+        $collection = \App\Models\FluidbookCollection::find(85);
+        $publications = $collection->publications;
+        $existing = [];
+        foreach ($publications as $publication) {
+            $existing[$publication['fluidbook']] = true;
+        }
+        $fluidbooks = \App\Models\FluidbookPublication::where('created_at', '>', '2025-11-21 00:00:00')->where('invoicable_company', 1880)->where('c_title', 'like', 'Hemsley Fraser%')->orderBy('id', 'DESC')->get();
+        foreach ($fluidbooks as $fb) {
+            if (isset($existing[$fb->id])) {
+                continue;
+            }
+            $id = $fb->id;
+            $publications[] = [
+                'fluidbook' => "$id",
+                'export' => '',
+                'dir' => ''
+            ];
+            $existing[$id] = true;
+        }
+        $collection->update(['publications' => json_encode($publications)]);
+    }
+}
index b03bb93eeacb1f66d2fd8aec715c9c51b2da94ef..d0e6d215c0613e2a0491ffcf808cd579da478b8a 100644 (file)
@@ -45,6 +45,7 @@ class Kernel extends \Cubist\Backpack\Console\Kernel
             // Mailjet
             $schedule->command('job:dispatchNow ListmonkSyncList')->dailyAt('5:00');
             // Link audit
+            $schedule->command('hemsleyfraser:auditcollection')->dailyAt('23:00');
             $schedule->command('job:dispatchNow AuditLinkRegister')->dailyAt('0:30');
             $schedule->command('job:dispatchNow AuditLink')->dailyAt('1:00');
         }