This commit is contained in:
x
2024-06-10 01:56:51 +02:00
parent b6d93f54ef
commit c05bcb758f
4 changed files with 15 additions and 2 deletions

View File

@@ -369,6 +369,7 @@ class UserController extends Controller
return view('video', [
'video' => $vid,
'related' => $user,
'isTag' => false,
'banner' => Banner::getRandom($vid->isSfw()),
'sfw' => $sfw
]);
@@ -435,6 +436,7 @@ class UserController extends Controller
return view('video', [
'video' => $vid,
'related' => $user,
'isTag' => false,
'banner' => Banner::getRandom($vid->isSfw()),
'sfw' => $sfw,
]);

View File

@@ -68,6 +68,17 @@ class Video extends Model
return $this->belongsToMany(User::class, 'favorites', 'video_id', 'user_id');
}
public function hasAllTags($tags) {
$tags = app(TagService::class)->buildTagArrayNormalized($tags);
$videotags = $this->getTagArrayNormalizedAttribute();
foreach ($tags as $t) {
if (!in_array($t,$videotags)) {
return false;
}
}
return true;
}
public static function getFirstId($related = null, $isTag = false) {
if ($related) {
if (!$isTag) {