0.1.5
This commit is contained in:
@@ -59,6 +59,21 @@ class ComicController extends Controller
|
||||
return str_replace(array_keys($this->zhConversion::ZH_TO_HANT), array_values($this->zhConversion::ZH_TO_HANT), $string);
|
||||
}
|
||||
|
||||
public function toggleHistory(Request $request): JsonResponse
|
||||
{
|
||||
if ($request->session()->has('historyDisabled')) {
|
||||
$newValue = !$request->session()->get('historyDisabled');
|
||||
} else {
|
||||
$newValue = true;
|
||||
}
|
||||
|
||||
// Put Session
|
||||
$request->session()->put('historyDisabled', $newValue);
|
||||
|
||||
// Return to frontend
|
||||
return response()->json(['historyDisabled' => $newValue]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show user favourites
|
||||
*
|
||||
@@ -323,7 +338,9 @@ class ComicController extends Controller
|
||||
ImageUpsert::dispatch($comicObj->id, $chapterObj->id, $chapter);
|
||||
|
||||
// Update history
|
||||
$request->user()->readingHistories()->attach($chapterObj->id, ['comic_id' => $comicObj->id]);
|
||||
if (!$request->session()->get('historyDisabled', false)) {
|
||||
$request->user()->readingHistories()->attach($chapterObj->id, ['comic_id' => $comicObj->id]);
|
||||
}
|
||||
|
||||
// Get chapters from DB
|
||||
$chapters = $comicObj->chapters()->where('metadata->group_path_word', $chapter['chapter']['group_path_word'])->orderBy('order')->get(['name', 'chapter_uuid']);
|
||||
|
||||
Reference in New Issue
Block a user