Update classes

This commit is contained in:
DariusIII
2019-03-12 15:01:38 +01:00
parent 2de79fd094
commit 673cd1c1b3
9 changed files with 19 additions and 16 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ class AdultController extends BasePageController
if ($id && \in_array($id, Arr::pluck($mtmp, 'title'), false)) {
$cat = Category::query()
->where('title', $id)
->where('parentid', '=', Category::XXX_ROOT)
->where('root_categories_id', '=', Category::XXX_ROOT)
->first(['id']);
$category = $cat !== null ? $cat['id'] : Category::XXX_ROOT;
}
+1 -1
View File
@@ -35,7 +35,7 @@ class BooksController extends BasePageController
if ($id && \in_array($id, Arr::pluck($btmp, 'title'), false)) {
$cat = Category::query()
->where('title', $id)
->where('parentid', '=', Category::BOOKS_ROOT)
->where('root_categories_id', '=', Category::BOOKS_ROOT)
->first(['id']);
$category = $cat !== null ? $cat['id'] : Category::BOOKS_ROOT;
}
+7 -7
View File
@@ -63,7 +63,7 @@ class BrowseController extends BasePageController
$query = Category::query();
if ($id !== 'All') {
$query->where('title', $id)->where('parentid', $parentId['id']);
$query->where('title', $id)->where('root_categories_id', $parentId['id']);
} else {
$query->where('id', $parentId['id']);
}
@@ -107,17 +107,17 @@ class BrowseController extends BasePageController
} elseif ($category !== -1 && $grp === -1) {
$cdata = Category::find($category['id']);
if ($cdata !== null) {
if ($cdata->parentid === Category::GAME_ROOT || $cdata->id === Category::GAME_ROOT) {
if ($cdata->root_categories_id === Category::GAME_ROOT || $cdata->id === Category::GAME_ROOT) {
$covgroup = 'console';
} elseif ($cdata->parentid === Category::MOVIE_ROOT || $cdata->id === Category::MOVIE_ROOT) {
} elseif ($cdata->root_categories_id === Category::MOVIE_ROOT || $cdata->id === Category::MOVIE_ROOT) {
$covgroup = 'movies';
} elseif ($cdata->parentid === Category::XXX_ROOT || $cdata->id === Category::XXX_ROOT) {
} elseif ($cdata->root_categories_id === Category::XXX_ROOT || $cdata->id === Category::XXX_ROOT) {
$covgroup = 'xxx';
} elseif ($cdata->parentid === Category::PC_ROOT || $cdata->id === Category::PC_GAMES) {
} elseif ($cdata->root_categories_id === Category::PC_ROOT || $cdata->id === Category::PC_GAMES) {
$covgroup = 'games';
} elseif ($cdata->parentid === Category::MUSIC_ROOT || $cdata->id === Category::MUSIC_ROOT) {
} elseif ($cdata->root_categories_id === Category::MUSIC_ROOT || $cdata->id === Category::MUSIC_ROOT) {
$covgroup = 'music';
} elseif ($cdata->parentid === Category::BOOKS_ROOT || $cdata->id === Category::BOOKS_ROOT) {
} elseif ($cdata->root_categories_id === Category::BOOKS_ROOT || $cdata->id === Category::BOOKS_ROOT) {
$covgroup = 'books';
}
}
+1 -1
View File
@@ -39,7 +39,7 @@ class ConsoleController extends BasePageController
if ($id && \in_array($id, Arr::pluck($ctmp, 'title'), false)) {
$cat = Category::query()
->where('title', $id)
->where('parentid', '=', Category::GAME_ROOT)
->where('root_categories_id', '=', Category::GAME_ROOT)
->first(['id']);
$category = $cat !== null ? $cat['id'] : Category::GAME_ROOT;
}
+1 -1
View File
@@ -74,7 +74,7 @@ class MovieController extends BasePageController
$category = $request->has('imdb') ? -1 : Category::MOVIE_ROOT;
if ($id && \in_array($id, Arr::pluck($mtmp, 'title'), false)) {
$cat = Category::query()
->where(['title'=> $id, 'parentid' => Category::MOVIE_ROOT])
->where(['title'=> $id, 'root_categories_id' => Category::MOVIE_ROOT])
->first(['id']);
$category = $cat !== null ? $cat['id'] : Category::MOVIE_ROOT;
}
+1 -1
View File
@@ -36,7 +36,7 @@ class MusicController extends BasePageController
if ($id && \in_array($id, Arr::pluck($mtmp, 'title'), false)) {
$cat = Category::query()
->where('title', $id)
->where('parentid', '=', Category::MUSIC_ROOT)
->where('root_categories_id', '=', Category::MUSIC_ROOT)
->first(['id']);
$category = $cat !== null ? $cat['id'] : Category::MUSIC_ROOT;
}
@@ -333,8 +333,6 @@ class ProfileController extends BasePageController
$this->smarty->assign('yesno_ids', [1, 0]);
$this->smarty->assign('yesno_names', ['Yes', 'No']);
$this->smarty->assign('catlist', Category::getForSelect(false));
$content = $this->smarty->fetch('profileedit.tpl');
$this->smarty->assign(compact('content', 'meta_title', 'meta_keywords', 'meta_description'));
+6 -1
View File
@@ -3,13 +3,18 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Watson\Rememberable\Rememberable;
class RootCategory extends Model
{
use Rememberable;
protected $guarded = [];
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function categories()
public function categories(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(Category::class, 'root_categories_id');
}
+1 -1
View File
@@ -825,7 +825,7 @@ class User extends Authenticatable
}
}
$exclusion = Category::query()->whereIn('parentid', $ret)->pluck('id')->toArray();
$exclusion = Category::query()->whereIn('root_categories_id', $ret)->pluck('id')->toArray();
return $exclusion;
}