feat: paginate workshops and videos pages

This commit is contained in:
Xavier Oliveira
2026-05-27 09:24:10 +01:00
parent da0baaee15
commit 68f99798ce
72 changed files with 3352 additions and 1044 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers;
use App\Models\Video;
use App\Models\VideoView;
use Illuminate\Http\Request;
class VideoViewController extends Controller
{
public function store(Video $video) {
$user = auth()->user();
//firstOrCreate só cria se não existir, se existir, atualiza o watched_at
VideoView::firstOrCreate([
'user_id' => $user->id,
'video_id' => $video->id,
], [
'watched_at' => now(),
]);
return response()->json(['watched' => true]);
}
}