blob: b99c80422c4f910fda1ecd783eb05c3e75816897 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php
namespace Handler;
use ORM;
use Request;
use RequestHandlerInterface;
use Response;
class StorepaginationHandler implements RequestHandlerInterface
{
public function handle(Request $request): Response
{
$bookid = (int) $request->getAttribute('id');
$payload = $request->getAttribute('payload');
if ($bookid && $payload) {
$pag = ORM::for_table('epube_pagination')
->where('bookid', $bookid)
->find_one();
if (!$pag) {
$pag = ORM::for_table('epube_pagination')->create();
$pag->bookid = $bookid;
}
$pag->pagination = $payload;
$pag->total_pages = 100;
$pag->save();
}
return new Response();
}
}
|