mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-10-17 12:03:00 -04:00
92 lines
2.3 KiB
PHP
92 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Modules\Frontend\Http\Controllers;
|
|
|
|
use Illuminate\Contracts\Support\Renderable;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Routing\Controller;
|
|
use Modules\Frontend\Entities\Creator;
|
|
use Modules\Frontend\Entities\FeaturedCreator;
|
|
use Modules\Frontend\Entities\Video;
|
|
use Modules\Frontend\Facades\Videos;
|
|
use Modules\Frontend\Repositories\SectionRepository;
|
|
use Modules\Frontend\Services\Creators;
|
|
use Modules\Frontend\Services\Sections;
|
|
use Modules\Frontend\Services\Settings;
|
|
|
|
class FrontendController extends Controller
|
|
{
|
|
protected $settings;
|
|
protected $creators;
|
|
protected $sections;
|
|
|
|
public function __construct() {
|
|
$this->settings = new Settings();
|
|
$this->creators = new Creators();
|
|
$this->sections = new Sections();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$heroVideo = $this->settings->getValue('hero-video');
|
|
$creators = $this->creators->getFeatured();
|
|
$sections = $this->sections->all();
|
|
|
|
return view('frontend::index', compact('heroVideo', 'creators', 'sections'));
|
|
}
|
|
|
|
public function manager()
|
|
{
|
|
return view('frontend::manager');
|
|
}
|
|
|
|
public function video(Request $request, Video $video)
|
|
{
|
|
$locale = 'en';
|
|
$video->load(['thumbnail', 'ottData.links']);
|
|
|
|
return view('frontend::video', compact('video'));
|
|
}
|
|
|
|
public function creatorVideos(Request $request, Creator $creator)
|
|
{
|
|
$videos = Videos::getByCreator($creator);
|
|
|
|
return view('frontend::creator-videos', compact('creator', 'videos'));
|
|
}
|
|
|
|
public function creators()
|
|
{
|
|
$creators = $this->creators->all();
|
|
|
|
return response()->json([
|
|
'creators' => $creators,
|
|
]);
|
|
}
|
|
|
|
public function featuredCreators()
|
|
{
|
|
$creators = $this->creators->getFeatured();
|
|
|
|
return response()->json([
|
|
'creators' => $creators,
|
|
]);
|
|
}
|
|
|
|
public function updateFeaturedCreators(Request $request)
|
|
{
|
|
$creators = $request->items;
|
|
$this->creators->updateFeatured($creators);
|
|
|
|
return response()->json([
|
|
'message' => __('frontend::common.featured-creators-updated'),
|
|
]);
|
|
}
|
|
|
|
public function setLocale(Request $request)
|
|
{
|
|
$locale = $request->locale;
|
|
session()->put('frontend_locale', $locale);
|
|
}
|
|
}
|