Design Refresh
This commit is contained in:
parent
1dee7ae516
commit
e7202174f7
44 changed files with 593 additions and 228 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue