first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Http\Controllers;
use App\Models\Title;
use Common\Core\BaseController;
use Illuminate\Support\Facades\DB;
class VideoOrderController extends BaseController
{
public function changeOrder(int $titleId)
{
$title = Title::findOrFail($titleId);
$this->authorize('update', $title);
request()->validate([
'ids' => 'array|min:1',
'ids.*' => 'integer',
]);
$queryPart = '';
foreach (request('ids') as $order => $id) {
$queryPart .= " when id=$id then $order";
}
DB::table('videos')
->whereIn('id', request('ids'))
->update(['order' => DB::raw("(case $queryPart end)")]);
return $this->success();
}
}