Код: Выделить всё
public function remove(Request $request) {
$user = Auth::user();
$videoId = $request->input('video');
DB::table('watch_later')->where('user_id', Auth::id())->where('video_id', $videoId)->delete();
return redirect()->back()->with('success', 'video removed from Watch Later');
}
Код: Выделить всё
@if($watchLaterVideos->isEmpty())
No videos
@else
@foreach($watchLaterVideos as $video)
[url={{ route(]
[img]{{URL([/img]
img) }}" alt="{{ $video->name }}">
{{$video->name}}
[/url]
@csrf
@method('DELETE')
Remove from Watch Later
@endforeach
@endif
Код: Выделить всё
Route::post('/watch-later/add', [\App\Http\Controllers\WatchLaterController::class, 'add'])->name('watch-later.add');
Route::delete('/watch-later/remove', [\App\Http\Controllers\WatchLaterController::class, 'remove'])->name('watch-later.remove');
Подробнее здесь: https://stackoverflow.com/questions/784 ... in-laravel
Мобильная версия