aboutsummaryrefslogtreecommitdiff
path: root/app/Models/BookmarkSite.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/BookmarkSite.php')
-rw-r--r--app/Models/BookmarkSite.php35
1 files changed, 0 insertions, 35 deletions
diff --git a/app/Models/BookmarkSite.php b/app/Models/BookmarkSite.php
deleted file mode 100644
index 3c9cc5d..0000000
--- a/app/Models/BookmarkSite.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use Illuminate\Database\Eloquent\Factories\HasFactory;
-use Illuminate\Database\Eloquent\Model;
-
-class BookmarkSite extends Model {
- use HasFactory;
- protected $table = "bookmark__sites";
- protected $fillable = ['name', 'description', 'url', 'category'];
-
- public function category() {
- return $this->belongsTo(BookmarkCategory::class, 'category');
- }
- public static function insertBookmark(string $name, string $url, int $category) {
- $category = BookmarkCategory::where('id', $category)->firstOrFail();
- $newBookmark = new BookmarkSite;
- $newBookmark->name = $name;
- $newBookmark->url = $url;
- $newBookmark->category = $category->id;
- $newBookmark->save();
- }
-
- public static function importBookmark(array $data) {
- foreach ($data as $site) {
- $newBookmark = new BookmarkSite;
- $newBookmark->name = $site['name'];
- $newBookmark->description = $site['description'];
- $newBookmark->url = $site['url'];
- $newBookmark->category = $site['category_id'];
- $newBookmark->save();
- }
- }
-}