Total Complexity | 6 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class UploadedPhotosRepository |
||
12 | { |
||
13 | /** |
||
14 | * @var UploadedPhoto |
||
15 | */ |
||
16 | private $model; |
||
17 | |||
18 | /** |
||
19 | * Constructor. |
||
20 | */ |
||
21 | public function __construct(UploadedPhoto $model) |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Create a new Uploaded Photo row in the database. |
||
28 | */ |
||
29 | public function create(array $attributes): UploadedPhoto |
||
30 | { |
||
31 | return $this->query()->create($attributes); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Return new instance of the Query Builder for this model. |
||
36 | */ |
||
37 | public function query(): Builder |
||
38 | { |
||
39 | return $this->model->newQuery(); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Delete a uploaded photo from the database. |
||
44 | */ |
||
45 | public function delete(int $uploadedPhotoID): ?bool |
||
46 | { |
||
47 | $uploadedPhoto = $this->find($uploadedPhotoID); |
||
48 | |||
49 | return $uploadedPhoto->delete(); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Find a blog etc uploaded photo by ID. |
||
54 | * |
||
55 | * If cannot find, throw exception. |
||
56 | */ |
||
57 | public function find(int $uploadedPhotoID): UploadedPhoto |
||
63 | } |
||
64 | } |
||
65 | } |
||
66 |