From a333d291966229a909c0851fd8b890ed97c48ceb Mon Sep 17 00:00:00 2001
From: Benjamin Bellamy <ben@podlibre.org>
Date: Mon, 8 Jun 2020 17:01:58 +0200
Subject: [PATCH] feat: add platform models

---
 app/Models/PlatformLinkModel.php | 31 +++++++++++++++++++++++++++
 app/Models/PlatformModel.php     | 36 ++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 app/Models/PlatformLinkModel.php
 create mode 100644 app/Models/PlatformModel.php

diff --git a/app/Models/PlatformLinkModel.php b/app/Models/PlatformLinkModel.php
new file mode 100644
index 0000000000..8642a2df88
--- /dev/null
+++ b/app/Models/PlatformLinkModel.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Class PlatformLinkModel
+ * Model for platform links table in database
+ * @author     Benjamin Bellamy <ben@podlibre.org>
+ * @copyright  2020 Podlibre
+ * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
+ * @link       https://castopod.org/
+ */
+namespace App\Models;
+
+use CodeIgniter\Model;
+
+class PlatformLinkModel extends Model
+{
+    protected $table = 'platform_links';
+    protected $primaryKey = 'id';
+
+    protected $allowedFields = [
+        'podcast_id',
+        'platform_id',
+        'link_url',
+        'comment',
+        'visible',
+    ];
+
+    protected $returnType = 'App\Entities\PlatformLink';
+    protected $useSoftDeletes = false;
+
+    protected $useTimestamps = true;
+}
\ No newline at end of file
diff --git a/app/Models/PlatformModel.php b/app/Models/PlatformModel.php
new file mode 100644
index 0000000000..58765cd642
--- /dev/null
+++ b/app/Models/PlatformModel.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Class PlatformModel
+ * Model for platforms table in database
+ * @author     Benjamin Bellamy <ben@podlibre.org>
+ * @copyright  2020 Podlibre
+ * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
+ * @link       https://castopod.org/
+ */
+namespace App\Models;
+
+use CodeIgniter\Model;
+
+class PlatformModel extends Model
+{
+    protected $table = 'platforms';
+    protected $primaryKey = 'id';
+
+    protected $allowedFields = [
+        'name',
+        'home_url',
+        'submit_url',
+        'iosapp_url',
+        'androidapp_url',
+        'comment',
+        'display_by_default',
+        'ios_deeplink',
+        'android_deeplink',
+        'logo_file_name',
+    ];
+
+    protected $returnType = 'App\Entities\Platform';
+    protected $useSoftDeletes = false;
+
+    protected $useTimestamps = true;
+}
\ No newline at end of file
-- 
GitLab