mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-10-18 06:03:02 -04:00
StudioPlus Module Update
Status filter and frontend filtering
This commit is contained in:
@@ -84,8 +84,6 @@ class StudioPlusVideoController extends Controller
|
||||
|
||||
public function index(Request $request, StudioPlusChannel $studioPlusChannel)
|
||||
{
|
||||
$status = explode(',', $request->status) ?: '';
|
||||
|
||||
$globalSetting = GlobalSetting::query()
|
||||
->where('type', 'Studio Pagination')
|
||||
->where('is_active', 1)
|
||||
@@ -123,7 +121,7 @@ class StudioPlusVideoController extends Controller
|
||||
}
|
||||
|
||||
//$query = auth()->user()->role->type === 'superadmin' || permissionCheck('studio-plus.can_view_all_videos')
|
||||
$query = auth()->user()->role->type === 'superadmin' || permissionCheck('studioplus.manage.videos') || $request->status == 'MVL'
|
||||
$query = auth()->user()->role->type === 'superadmin' || permissionCheck('studioplus.manage.videos') || in_array('MVL', $request->status)
|
||||
? StudioPlusVideo::query()
|
||||
: StudioPlusVideo::query()
|
||||
->where(
|
||||
@@ -157,7 +155,7 @@ class StudioPlusVideoController extends Controller
|
||||
])
|
||||
//->filter($request)
|
||||
->when($request->filled('category_id'), fn ($query) => $query->where('studio_plus_category_id', $request->category_id))
|
||||
->when($request->filled('status') && $request->status !== 'All' && $request->status !== 'MVL', fn ($query) => $query->where('status', $status))
|
||||
->when($request->filled('status') && !in_array('MVL', $request->status), fn ($query) => $query->whereIn('status', $request->status))
|
||||
->when(isset($request->start_date) && strtotime($request->start_date) && isset($request->end_date) && strtotime($request->end_date), function($query) use($request) {
|
||||
$startDate = Carbon::createFromFormat('Y-m-d', $request->start_date)->startOfDay();
|
||||
$endDate = Carbon::createFromFormat('Y-m-d', $request->end_date)->endOfDay();
|
||||
@@ -458,10 +456,21 @@ class StudioPlusVideoController extends Controller
|
||||
(new VideoInvoice())->addIncentiveItem($studioPlusVideo);
|
||||
DB::commit();
|
||||
|
||||
//return response()->noContent();
|
||||
|
||||
$studioPlusVideo->load([
|
||||
'thumbnail',
|
||||
'thumbnails',
|
||||
'videoType',
|
||||
'otts.links',
|
||||
'category',
|
||||
'asinData',
|
||||
'channel.user.staff',
|
||||
'urls',
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Status updated'
|
||||
'message' => 'Status updated',
|
||||
'video' => $studioPlusVideo
|
||||
]);
|
||||
} catch (\Exception $ex) {
|
||||
DB::rollBack();
|
||||
@@ -536,7 +545,7 @@ class StudioPlusVideoController extends Controller
|
||||
}
|
||||
public function videoStatistics(Request $request, StudioPlusChannel $studioPlusChannel)
|
||||
{
|
||||
$statistics = auth()->user()->role->type === 'superadmin' || permissionCheck('studioplus.manage.videos') || $request->status === 'MVL'
|
||||
$statistics = auth()->user()->role->type === 'superadmin' || permissionCheck('studioplus.manage.videos') || in_array('MVL', $request->status)
|
||||
? StudioPlusVideo::query()
|
||||
: StudioPlusVideo::query()
|
||||
->where(
|
||||
@@ -557,7 +566,7 @@ class StudioPlusVideoController extends Controller
|
||||
//->whereHas('channel', fn ($query) => $query->where('id', $studioPlusChannel->id))))
|
||||
->filter($request)
|
||||
->when($request->filled('category_id'), fn ($query) => $query->where('studio_plus_category_id', $request->category_id))
|
||||
->when($request->filled('status') && $request->status !== 'All' && $request->status !== 'MVL', fn ($query) => $query->where('status', explode(',', $request->status) ?: ''))
|
||||
->when($request->filled('status') && !in_array('MVL', $request->status), fn ($query) => $query->whereIn('status', $request->status))
|
||||
->when($request->filled('start_date') && $request->filled('end_date') && strtotime($request->start_date) && strtotime($request->end_date), function($query) use($request) {
|
||||
$startDate = Carbon::createFromFormat('Y-m-d', $request->start_date)->startOfDay();
|
||||
$endDate = Carbon::createFromFormat('Y-m-d', $request->end_date)->endOfDay();
|
||||
@@ -1221,8 +1230,21 @@ class StudioPlusVideoController extends Controller
|
||||
$studioPlusVideo->update();
|
||||
}
|
||||
|
||||
|
||||
$studioPlusVideo->load([
|
||||
'thumbnail',
|
||||
'thumbnails',
|
||||
'videoType',
|
||||
'otts.links',
|
||||
'category',
|
||||
'asinData',
|
||||
'channel.user.staff',
|
||||
'urls',
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Video primary tags has been saved.'
|
||||
'message' => 'Video primary tags has been saved.',
|
||||
'video' => $studioPlusVideo
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user