marking chapters as complete and toggling value from course list and chapter page.

This commit is contained in:
Krzysztof Płaczek
2023-06-13 16:39:20 +02:00
parent 018597faaa
commit 301244cdb0
7 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers\Chapter;
use App\Http\Controllers\Controller;
use App\Models\Chapter;
use App\Models\Course;
use Illuminate\Http\RedirectResponse;
class CompleteToggle extends Controller
{
public function __invoke(Course $course, Chapter $chapter): RedirectResponse
{
$chapter->update(['is_complete' => !$chapter->is_complete]);
return redirect()->back();
}
}