|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Adminetic\Website\Repositories; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\Facades\Cache; |
|
6
|
|
|
use Adminetic\Website\Models\Admin\Feature; |
|
7
|
|
|
use Adminetic\Website\Http\Requests\FeatureRequest; |
|
8
|
|
|
use Adminetic\Website\Contracts\FeatureRepositoryInterface; |
|
9
|
|
|
use Intervention\Image\Facades\Image; |
|
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
class FeatureRepository implements FeatureRepositoryInterface |
|
12
|
|
|
{ |
|
13
|
|
|
// Feature Index |
|
14
|
|
|
public function indexFeature() |
|
15
|
|
|
{ |
|
16
|
|
|
$features = config('adminetic.caching', true) |
|
17
|
|
|
? (Cache::has('features') ? Cache::get('features') : Cache::rememberForever('features', function () { |
|
18
|
|
|
return Feature::latest()->get(); |
|
19
|
|
|
})) |
|
20
|
|
|
: Feature::latest()->get(); |
|
21
|
|
|
return compact('features'); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
// Feature Create |
|
25
|
|
|
public function createFeature() |
|
26
|
|
|
{ |
|
27
|
|
|
// |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
// Feature Store |
|
31
|
|
|
public function storeFeature(FeatureRequest $request) |
|
32
|
|
|
{ |
|
33
|
|
|
$feature = Feature::create($request->validated()); |
|
34
|
|
|
$this->uploadImage($feature); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
// Feature Show |
|
38
|
|
|
public function showFeature(Feature $feature) |
|
39
|
|
|
{ |
|
40
|
|
|
return compact('feature'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
// Feature Edit |
|
44
|
|
|
public function editFeature(Feature $feature) |
|
45
|
|
|
{ |
|
46
|
|
|
return compact('feature'); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
// Feature Update |
|
50
|
|
|
public function updateFeature(FeatureRequest $request, Feature $feature) |
|
51
|
|
|
{ |
|
52
|
|
|
$feature->update($request->validated()); |
|
53
|
|
|
$this->uploadImage($feature); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
// Feature Destroy |
|
57
|
|
|
public function destroyFeature(Feature $feature) |
|
58
|
|
|
{ |
|
59
|
|
|
$feature->image ? deleteImage($feature->image) : ''; |
|
|
|
|
|
|
60
|
|
|
$feature->delete(); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
// Upload Image |
|
64
|
|
|
protected function uploadImage(Feature $feature) |
|
65
|
|
|
{ |
|
66
|
|
|
if (request()->image) { |
|
67
|
|
|
$feature->update([ |
|
68
|
|
|
'image' => request()->image->store('website/feature/image', 'public'), |
|
69
|
|
|
]); |
|
70
|
|
|
$image = Image::make(request()->file('image')->getRealPath()); |
|
71
|
|
|
$image->save(public_path('storage/' . $feature->image)); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
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