53 lines
1.6 KiB
PHP
53 lines
1.6 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Admin;
|
||
|
|
|
||
|
|
use App\Http\Controllers\Controller;
|
||
|
|
use App\Services\Admin\ManageContactService;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use App\Models\ContactUs;
|
||
|
|
use Maatwebsite\Excel\Facades\Excel;
|
||
|
|
use App\Exports\UsersExport;
|
||
|
|
|
||
|
|
class ManageContactController extends Controller {
|
||
|
|
|
||
|
|
public function __construct(ManageContactService $manageContactService) {
|
||
|
|
$this->manageContactService = $manageContactService;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function create() {
|
||
|
|
return view('Admin.Pages.manage_contact.manage_contact');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function view_contact(Request $req) {
|
||
|
|
$manage_contact = $this->manageContactService->view_contact();
|
||
|
|
return view('Admin.Pages.manage_contact.manage_contact')->with(['manage_contact' => $manage_contact]);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function deleted(Request $request) {
|
||
|
|
$deleted_contact = $this->manageContactService->delete_contact();
|
||
|
|
return view('Admin.Pages.manage_contact.manage_contact_deleted')->with(['deleted_contact' => $deleted_contact]);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function delete_contact($id) {
|
||
|
|
ContactUs::find($id)->delete();
|
||
|
|
}
|
||
|
|
|
||
|
|
public function sendManageContact(Request $request) {
|
||
|
|
|
||
|
|
$contact = $this->manageContactService->send_mail($request);
|
||
|
|
return response()->json([
|
||
|
|
'status' => 200
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function exportUser()
|
||
|
|
{
|
||
|
|
// return Excel::download(new UsersExport, 'users.xlsx');
|
||
|
|
// return Excel::download(new UsersExport, 'user.xlsx', \Maatwebsite\Excel\Excel::XLSX);
|
||
|
|
// return Excel::download(new UsersExport, 'user.xlsx');
|
||
|
|
return Excel::download(new UsersExport, 'user.xlsx');
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|