-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
routes.php
55 lines (51 loc) · 982 Bytes
/
routes.php
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
49
50
51
52
53
54
55
<?php
namespace Oblik\KirbyGit;
return [
[
'pattern' => 'git/status',
'method' => 'get',
'action' => function () {
return (new Git())->status();
}
],
[
'pattern' => 'git/add',
'method' => 'post',
'action' => function () {
return (new Git())->add();
}
],
[
'pattern' => 'git/commit',
'method' => 'post',
'action' => function () {
$data = kirby()->request()->data();
$message = $data['message'] ?? null;
return (new Git())->commit($message);
}
],
[
'pattern' => 'git/log',
'method' => 'get',
'action' => function () {
$data = kirby()->request()->data();
$page = (int) ($data['page'] ?? 1);
$limit = (int) ($data['limit'] ?? 50);
return (new Git())->log($page, $limit);
}
],
[
'pattern' => 'git/push',
'method' => 'post',
'action' => function () {
return (new Git())->push();
}
],
[
'pattern' => 'git/pull',
'method' => 'get',
'action' => function () {
return (new Git())->pull();
}
]
];