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