1 | <?php |
||
2 | |||
3 | namespace seregazhuk\PinterestBot\Api\Traits; |
||
4 | |||
5 | /** |
||
6 | * Trait CanBeDeleted |
||
7 | * |
||
8 | * @property string $deleteUrl |
||
9 | */ |
||
10 | trait CanBeDeleted |
||
11 | { |
||
12 | use HandlesRequest, HasEntityIdName; |
||
13 | |||
14 | protected function requiresLoginForCanBeDelete() |
||
15 | { |
||
16 | return [ |
||
17 | 'delete', |
||
18 | ]; |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * Delete entity by ID. |
||
23 | * |
||
24 | * @param int $entityId |
||
25 | * |
||
26 | * @return bool |
||
27 | */ |
||
28 | public function delete($entityId) |
||
29 | { |
||
30 | return $this->post( |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
31 | $this->getDeleteUrl(), |
||
32 | [$this->getEntityIdName() => $entityId] |
||
33 | ); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @return string |
||
38 | */ |
||
39 | protected function getDeleteUrl() |
||
40 | { |
||
41 | return property_exists($this, 'deleteUrl') ? $this->deleteUrl : ''; |
||
42 | } |
||
43 | } |
||
44 |