Updated to latest

This commit is contained in:
Fritz Ramirez
2024-03-07 00:12:30 -05:00
parent 8a157b04eb
commit b89575390f
18 changed files with 363 additions and 147 deletions
@@ -188,28 +188,31 @@ class StudioPlusVideoController extends Controller
$query->whereIn('studio_plus_category_id', $request->categories);
})
->when($request->filled('types'), function($query) use($request) {
$types = array_map(function($item) {
return strtoupper($item);
}, $request->types);
$query->where(function($query) use($types) {
for ($i = 0; $i < count($types); $i++) {
$type = $types[$i];
if ($type == 'POV') {
$query->orWhere(function($query) {
$query->whereJsonLength('types', 0)->where('is_short', false);
});
} else {
$query->orWhereJsonContains('types',[$type]);
}
}
if (in_array('SHORTS', $types)) {
$query->orWhere('is_short', true);
}
});
$query->whereIn('studio_plus_video_type_id', $request->types);
})
// ->when($request->filled('types'), function($query) use($request) {
// $types = array_map(function($item) {
// return strtoupper($item);
// }, $request->types);
// $query->where(function($query) use($types) {
// for ($i = 0; $i < count($types); $i++) {
// $type = $types[$i];
// if ($type == 'POV') {
// $query->orWhere(function($query) {
// $query->whereJsonLength('types', 0)->where('is_short', false);
// });
// } else {
// $query->orWhereJsonContains('types',[$type]);
// }
// }
// if (in_array('SHORTS', $types)) {
// $query->orWhere('is_short', true);
// }
// });
// })
->when($request->filled('asins'), function($query) use($request) {
$query->whereIn('studio_plus_asin_id', $request->asins);
})
@@ -645,28 +648,31 @@ class StudioPlusVideoController extends Controller
$query->whereIn('studio_plus_category_id', $request->categories);
})
->when($request->filled('types'), function($query) use($request) {
$types = array_map(function($item) {
return strtoupper($item);
}, $request->types);
$query->where(function($query) use($types) {
for ($i = 0; $i < count($types); $i++) {
$type = $types[$i];
if ($type == 'POV') {
$query->orWhere(function($query) {
$query->whereJsonLength('types', 0)->where('is_short', false);
});
} else {
$query->orWhereJsonContains('types',[$type]);
}
}
if (in_array('SHORTS', $types)) {
$query->orWhere('is_short', true);
}
});
$query->whereIn('studio_plus_video_type_id', $request->types);
})
// ->when($request->filled('types'), function($query) use($request) {
// $types = array_map(function($item) {
// return strtoupper($item);
// }, $request->types);
// $query->where(function($query) use($types) {
// for ($i = 0; $i < count($types); $i++) {
// $type = $types[$i];
// if ($type == 'POV') {
// $query->orWhere(function($query) {
// $query->whereJsonLength('types', 0)->where('is_short', false);
// });
// } else {
// $query->orWhereJsonContains('types',[$type]);
// }
// }
// if (in_array('SHORTS', $types)) {
// $query->orWhere('is_short', true);
// }
// });
// })
->when($request->filled('asins'), function($query) use($request) {
$query->whereIn('studio_plus_asin_id', $request->asins);
})
@@ -900,6 +906,7 @@ class StudioPlusVideoController extends Controller
$video->load([
'thumbnail',
'thumbnails',
'videoType',
'category',
'asinData',
'channel.user',