-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthorController.php
More file actions
48 lines (30 loc) · 827 Bytes
/
authorController.php
File metadata and controls
48 lines (30 loc) · 827 Bytes
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
// your path will be different
require_once(__DIR__ . '/pdo_5_author_repo.php');
class authorController{
public static function author($id)
{
// your path will be different
$h = require (__DIR__ . '/pubs_connect.php');
$auRepo = new authorRepo($h);
$author = $auRepo->find($id);
echo json_encode($author);
}
public static function updateAuthor($au)
{
// your path will be different
$h = require (__DIR__ . '/pubs_connect.php');
$auRepo = new authorRepo($h);
$author = $auRepo->update($au);
echo json_encode($author);
}
public static function authors()
{
// your path will be different
$h = require (__DIR__ . '/pubs_connect.php');
$auRepo = new authorRepo($h);
$authors = $auRepo->findAll();
echo json_encode($authors);
}
};
?>