mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-14 18:02:01 -04:00
32 lines
932 B
PHP
32 lines
932 B
PHP
<?php
|
|
|
|
namespace Modules\StudioPlus\Http\Controllers\API;
|
|
|
|
use Illuminate\Contracts\Support\Renderable;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Routing\Controller;
|
|
use Modules\StudioPlus\Entities\StudioPlusVideo;
|
|
|
|
class VideoController extends Controller
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$videos = StudioPlusVideo::query()
|
|
->with([
|
|
'channel.user',
|
|
'thumbnail'
|
|
])
|
|
|
|
->when($request->filled('short'), function ($query) use ($request) {
|
|
$query->where('is_short', $request->short);
|
|
})
|
|
->when($request->filled('watching'), fn ($query) => $query->where('id', '!=', $request->watching))
|
|
->where('visibility', StudioPlusVideo::VISIBILITY_TYPE_PUBLIC)
|
|
->filter($request)
|
|
->latest()
|
|
->get();
|
|
|
|
return $videos;
|
|
}
|
|
}
|