Design Refresh

This commit is contained in:
Roscoe 2026-01-23 23:16:08 +00:00
commit e7202174f7
Signed by: RoscoeDaWah
SSH key fingerprint: SHA256:Hqn452XQ1ETzUt/FthJu6+OFkS4NBxCv5VQSEvuk7CE
44 changed files with 593 additions and 228 deletions

View file

@ -4,18 +4,29 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
class BookmarkCategory extends Model
{
use HasFactory;
protected $table = "bookmark__categories";
protected $fillable = ['name'];
protected $fillable = ['name', 'shuffled'];
protected $casts = ['shuffled' => 'boolean'];
public function sites() {
return $this->hasMany(BookmarkSite::class, 'category');
}
public static function insertBookmarkCategory(string $name) {
public static function create(Request $request): BookmarkCategory {
$newCategory = new BookmarkCategory();
$newCategory->name = $request->get('name');
$newCategory->shuffled = $request->has('shuffled');
$newCategory->save();
return $newCategory;
}
public static function insertBookmarkCategory(string $name): void {
$newBookmarkCategory = new BookmarkCategory;
$newBookmarkCategory->name = $name;
$newBookmarkCategory->save();
@ -24,13 +35,4 @@ public static function selectBookmarks(int $id) {
$bookmarks = BookmarkSite::where('category', '=', $id)->firstOrFail();
return $bookmarks;
}
public static function importBookmarkCategory(array $data) {
foreach ($data as $category) {
$newBookmarkCategory = new BookmarkCategory;
$newBookmarkCategory->name = $category['name'];
$newBookmarkCategory->priority = intval($category['priority']);
$newBookmarkCategory->save();
}
}
}