1 | <?php |
||
2 | |||
3 | namespace Firesphere\HaveIBeenPwned\Models; |
||
4 | |||
5 | use Firesphere\HaveIBeenPwned\Controllers\HaveIBeenPwnedPageController; |
||
6 | use Page; |
||
7 | use SilverStripe\Security\Member; |
||
8 | |||
9 | // This page should not be instantiated if the Page class doesn't exist. |
||
10 | if (!class_exists('\Page')) { |
||
11 | return; |
||
12 | } |
||
13 | |||
14 | /** |
||
15 | * Class \Firesphere\HaveIBeenPwned\Models\HaveIBeenPwnedPage |
||
16 | * |
||
17 | */ |
||
18 | class HaveIBeenPwnedPage extends Page |
||
19 | { |
||
20 | private static $table_name = 'HaveIBeenPwnedPage'; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
21 | |||
22 | /** |
||
23 | * Get the controller name for this page |
||
24 | * |
||
25 | * @return string |
||
26 | */ |
||
27 | public function getControllerName() |
||
28 | { |
||
29 | return HaveIBeenPwnedPageController::class; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @param null|Member $member |
||
34 | * @param array $context |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function canCreate($member = null, $context = array()) |
||
38 | { |
||
39 | // This page should only exist once |
||
40 | if (static::get()->count()) { |
||
41 | return false; |
||
42 | } |
||
43 | |||
44 | return parent::canCreate($member, $context); |
||
45 | } |
||
46 | } |
||
47 |