Add searching texture for uploaders themselves

This commit is contained in:
gplane 2017-04-24 17:13:06 +08:00
parent 16ff93c32d
commit fdea88eb2b

View File

@ -82,8 +82,7 @@ class SkinlibController extends Controller
if ($filter == "skin") {
$textures = Texture::like('name', $q)->where(function($query) use ($q) {
$query->where('public', '=', '1')
->where('type', '=', 'steve')
$query->where('type', '=', 'steve')
->orWhere('type', '=', 'alex');
})->orderBy($sort_by, 'desc')->get();
} else {
@ -93,6 +92,16 @@ class SkinlibController extends Controller
->orderBy($sort_by, 'desc')->get();
}
if (!is_null($this->user)) {
// show private textures when show uploaded textures of current user
if (!$this->user->isAdmin()) {
$textures = $textures->where('public', 1)
->merge($textures->where('uploader', $this->user->uid));
}
} else {
$textures = $textures->where('public', '1');
}
return view('skinlib.search')->with('user', $this->user)
->with('sort', $sort)
->with('filter', $filter)