1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Services; |
4
|
|
|
|
5
|
|
|
use App\Models\Sound; |
6
|
|
|
|
7
|
|
|
class SoundServices |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Get the Sounds from Database. |
11
|
|
|
* |
12
|
|
|
* @param int $id Sound Id |
13
|
|
|
* |
14
|
|
|
* @return Collection The Sound |
|
|
|
|
15
|
|
|
*/ |
16
|
|
|
public static function getSound($id) |
17
|
|
|
{ |
18
|
|
|
if (!$id) { |
19
|
|
|
return abort(404); |
|
|
|
|
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
return Sound::findOrFail($id); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Gets the sorted sounds. |
27
|
|
|
* |
28
|
|
|
* @return collection The sorted sounds. |
|
|
|
|
29
|
|
|
*/ |
30
|
|
|
public static function getSortedSounds() |
31
|
|
|
{ |
32
|
|
|
return Sound::sortedSounds()->get(); |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Gets the enabled and sorted sounds. |
37
|
|
|
* |
38
|
|
|
* @return collection The enabled sorted sounds. |
39
|
|
|
*/ |
40
|
|
|
public static function getEnabledSortedSounds() |
41
|
|
|
{ |
42
|
|
|
return Sound::enabledSounds()->sortedSounds()->get(); |
|
|
|
|
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Gets the blank sound. |
47
|
|
|
* |
48
|
|
|
* @return Empty Sound Collection. |
|
|
|
|
49
|
|
|
*/ |
50
|
|
|
public static function getBlankSound() |
51
|
|
|
{ |
52
|
|
|
return new Sound; |
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Update a sound |
57
|
|
|
* |
58
|
|
|
* @param collection $sound The sound |
59
|
|
|
* @param array $soundData The sound data |
60
|
|
|
* |
61
|
|
|
* @return Collection Sound |
62
|
|
|
*/ |
63
|
|
|
public static function updateSound($sound, $soundData) |
64
|
|
|
{ |
65
|
|
|
$sound->fill($soundData); |
66
|
|
|
$sound->save(); |
67
|
|
|
|
68
|
|
|
return $sound; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Stores a new sound. |
73
|
|
|
* |
74
|
|
|
* @param array $soundData The sound data |
75
|
|
|
* |
76
|
|
|
* @return collection $newSound The newly stored sound |
77
|
|
|
*/ |
78
|
|
|
public static function storeNewSound($soundData) |
79
|
|
|
{ |
80
|
|
|
$lastSound = collect(Sound::sortedSounds()->get())->last(); |
81
|
|
|
$sort_order = ['sort_order' => $lastSound->sort_order + 1]; |
82
|
|
|
$newSound = Sound::create(array_merge($soundData, $sort_order)); |
83
|
|
|
|
84
|
|
|
return $newSound; |
|
|
|
|
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Delete a sound |
89
|
|
|
* |
90
|
|
|
* @param collection $sound The sound |
91
|
|
|
* |
92
|
|
|
* @return Collection of deleted Sound |
93
|
|
|
*/ |
94
|
|
|
public static function deleteSound($sound) |
95
|
|
|
{ |
96
|
|
|
$sound->delete(); |
97
|
|
|
|
98
|
|
|
return $sound; |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths