mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-31 05:16:49 -04:00
StudioPlus Module Update - dynamic watermarks by video types
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\StudioPlus\Http\Controllers\API;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Modules\StudioPlus\Http\Requests\StoreContentWatermarkRequest;
|
||||
use Modules\StudioPlus\Repositories\ContentWatermarksRepository;
|
||||
|
||||
class StudioPlusWatermarkController extends Controller
|
||||
{
|
||||
protected $repository;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->repository = new ContentWatermarksRepository();
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
return $this->repository->getAll();
|
||||
}
|
||||
|
||||
public function store(StoreContentWatermarkRequest $request)
|
||||
{
|
||||
$watermark = $this->repository->store($request);
|
||||
|
||||
if ($watermark) {
|
||||
$watermark->load(['videoTypes']);
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Watermark has been saved.',
|
||||
'watermark' => $watermark,
|
||||
'watermarks' => $this->repository->getAll()
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Failed to save watermark.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
public function update(StoreContentWatermarkRequest $request)
|
||||
{
|
||||
$watermark = $this->repository->find($request->id);
|
||||
|
||||
if ($watermark) {
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Watermark has been updated.',
|
||||
'watermark' => $this->repository->update($watermark, $request),
|
||||
'watermarks' => $this->repository->getAll()
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Watermark not found.'
|
||||
], 404);
|
||||
}
|
||||
|
||||
public function destroy(StudioPlusVideoType $videoType)
|
||||
{
|
||||
$videoType->delete();
|
||||
|
||||
Cache::forget('studio_plus_video_types');
|
||||
|
||||
return response()->noContent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user