visuddhinanda 1 år sedan
förälder
incheckning
8d97e9d578
1 ändrade filer med 26 tillägg och 0 borttagningar
  1. 26 0
      api-v8/app/Http/Api/NotificationApi.php

+ 26 - 0
api-v8/app/Http/Api/NotificationApi.php

@@ -0,0 +1,26 @@
+<?php
+namespace App\Http\Api;
+
+use App\Models\Notification;
+use Illuminate\Support\Str;
+
+class NotificationApi{
+    public static function send($data){
+        $insertData = [];
+        foreach ($data as $key => $row) {
+            $insertData[] = [
+                'id' => Str::uuid(),
+                'from' => $row['from'],
+                'to' => $row['to'],
+                'url' => $row['url'],
+                'content' => $row['content'],
+                'res_type' => $row['res_type'],
+                'res_id' => $row['res_id'],
+                'updated_at' => now(),
+                'created_at' => now(),
+            ];
+        }
+        $insert = Notification::insert($insertData);
+        return $insert;
+    }
+}