Restyled by php-cs-fixer
This commit is contained in:
parent
ba9fa0f12a
commit
711ac93cb9
17 changed files with 74 additions and 47 deletions
|
|
@ -11,23 +11,27 @@ class BookmarkCategory extends Model
|
|||
protected $table = "bookmark__categories";
|
||||
protected $fillable = ['name'];
|
||||
|
||||
public function sites() {
|
||||
public function sites()
|
||||
{
|
||||
return $this->hasMany(BookmarkSite::class, 'category');
|
||||
}
|
||||
|
||||
public static function insertBookmarkCategory(string $name) {
|
||||
$newBookmarkCategory = new BookmarkCategory;
|
||||
public static function insertBookmarkCategory(string $name)
|
||||
{
|
||||
$newBookmarkCategory = new BookmarkCategory();
|
||||
$newBookmarkCategory->name = $name;
|
||||
$newBookmarkCategory->save();
|
||||
}
|
||||
public static function selectBookmarks(int $id) {
|
||||
public static function selectBookmarks(int $id)
|
||||
{
|
||||
$bookmarks = BookmarkSite::where('category', '=', $id)->firstOrFail();
|
||||
return $bookmarks;
|
||||
}
|
||||
|
||||
public static function importBookmarkCategory(array $data) {
|
||||
public static function importBookmarkCategory(array $data)
|
||||
{
|
||||
foreach ($data as $category) {
|
||||
$newBookmarkCategory = new BookmarkCategory;
|
||||
$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