|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Adminetic\Contact\Http\Controllers\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
|
|
6
|
|
|
use Maatwebsite\Excel\Facades\Excel; |
|
7
|
|
|
use Adminetic\Contact\Models\Admin\Contact; |
|
8
|
|
|
use Adminetic\Contact\Exports\ContactsExport; |
|
9
|
|
|
use Adminetic\Contact\Imports\ContactsImport; |
|
10
|
|
|
use Adminetic\Contact\Http\Requests\ContactRequest; |
|
11
|
|
|
use Adminetic\Contact\Contracts\ContactRepositoryInterface; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
class ContactController extends Controller |
|
16
|
|
|
{ |
|
17
|
|
|
protected $contactRepositoryInterface; |
|
18
|
|
|
|
|
19
|
|
|
public function __construct(ContactRepositoryInterface $contactRepositoryInterface) |
|
20
|
|
|
{ |
|
21
|
|
|
$this->contactRepositoryInterface = $contactRepositoryInterface; |
|
22
|
|
|
$this->authorizeResource(Contact::class, 'contact'); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Display a listing of the resource. |
|
28
|
|
|
* |
|
29
|
|
|
* @return \Illuminate\Http\Response |
|
30
|
|
|
*/ |
|
31
|
|
|
public function index() |
|
32
|
|
|
{ |
|
33
|
|
|
return view('contact::admin.contact.index', $this->contactRepositoryInterface->indexContact()); |
|
|
|
|
|
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Show the form for creating a new resource. |
|
38
|
|
|
* |
|
39
|
|
|
* @return \Illuminate\Http\Response |
|
40
|
|
|
*/ |
|
41
|
|
|
public function create() |
|
42
|
|
|
{ |
|
43
|
|
|
return view('contact::admin.contact.create'); |
|
|
|
|
|
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Store a newly created resource in storage. |
|
48
|
|
|
* |
|
49
|
|
|
* @param \Adminetic\Contact\Http\Requests\ContactRequest $request |
|
50
|
|
|
* @return \Illuminate\Http\Response |
|
51
|
|
|
*/ |
|
52
|
|
|
public function store(ContactRequest $request) |
|
53
|
|
|
{ |
|
54
|
|
|
$this->contactRepositoryInterface->storeContact($request); |
|
55
|
|
|
return redirect(adminRedirectRoute('contact'))->withSuccess('Contact Created Successfully.'); |
|
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Display the specified resource. |
|
60
|
|
|
* |
|
61
|
|
|
* @param \Adminetic\Contact\Models\Admin\Contact $contact |
|
62
|
|
|
* @return \Illuminate\Http\Response |
|
63
|
|
|
*/ |
|
64
|
|
|
public function show(Contact $contact) |
|
65
|
|
|
{ |
|
66
|
|
|
return view('contact::admin.contact.show', $this->contactRepositoryInterface->showContact($contact)); |
|
|
|
|
|
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Show the form for editing the specified resource. |
|
71
|
|
|
* |
|
72
|
|
|
* @param \Adminetic\Contact\Models\Admin\Contact $contact |
|
73
|
|
|
* @return \Illuminate\Http\Response |
|
74
|
|
|
*/ |
|
75
|
|
|
public function edit(Contact $contact) |
|
76
|
|
|
{ |
|
77
|
|
|
return view('contact::admin.contact.edit', $this->contactRepositoryInterface->editContact($contact)); |
|
|
|
|
|
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Update the specified resource in storage. |
|
82
|
|
|
* |
|
83
|
|
|
* @param \Adminetic\Contact\Http\Requests\ContactRequest $request |
|
84
|
|
|
* @param \Adminetic\Contact\Models\Admin\Contact $contact |
|
85
|
|
|
* @return \Illuminate\Http\Response |
|
86
|
|
|
*/ |
|
87
|
|
|
public function update(ContactRequest $request, Contact $contact) |
|
88
|
|
|
{ |
|
89
|
|
|
$this->contactRepositoryInterface->updateContact($request, $contact); |
|
90
|
|
|
return redirect(adminRedirectRoute('contact'))->withInfo('Contact Updated Successfully.'); |
|
|
|
|
|
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Remove the specified resource from storage. |
|
95
|
|
|
* |
|
96
|
|
|
* @param \Adminetic\Contact\Models\Admin\Contact $contact |
|
97
|
|
|
* @return \Illuminate\Http\Response |
|
98
|
|
|
*/ |
|
99
|
|
|
public function destroy(Contact $contact) |
|
100
|
|
|
{ |
|
101
|
|
|
$this->contactRepositoryInterface->destroyContact($contact); |
|
102
|
|
|
return redirect(adminRedirectRoute('contact'))->withFail('Contact Deleted Successfully.'); |
|
|
|
|
|
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* |
|
107
|
|
|
* Import Contacts |
|
108
|
|
|
* |
|
109
|
|
|
*/ |
|
110
|
|
|
public function import() |
|
111
|
|
|
{ |
|
112
|
|
|
Excel::import(new ContactsImport, request()->file('contacts_import')); |
|
|
|
|
|
|
113
|
|
|
return redirect(adminRedirectRoute('contact'))->withSuccess('Contacts Imported.'); |
|
|
|
|
|
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* |
|
118
|
|
|
* Export Contacts |
|
119
|
|
|
* |
|
120
|
|
|
*/ |
|
121
|
|
|
public function export() |
|
122
|
|
|
{ |
|
123
|
|
|
return Excel::download(new ContactsExport, 'contacts.xlsx'); |
|
124
|
|
|
} |
|
125
|
|
|
} |
|
126
|
|
|
|
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