44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Services\Admin;
|
|
|
|
use Mail;
|
|
use App\Models\ContactUs;
|
|
use App\Models\ContactUsAdvanced;
|
|
use App\Mail\ReplyContactUsMail;
|
|
use App\Mail\ReplyInvestorMail;
|
|
|
|
class ContactUsService
|
|
{
|
|
|
|
public function getAllData()
|
|
{
|
|
return ContactUs::latest()->get();
|
|
}
|
|
|
|
public function sendMail($email, $subject, $reply, $investorMail = null, $username = null, $from_kyc = null)
|
|
{
|
|
$data['subject'] = $subject;
|
|
$data['message'] = $reply;
|
|
$data['username'] = $username;
|
|
$data['from_kyc'] = $from_kyc;
|
|
if($investorMail)
|
|
{
|
|
return Mail::to($email)->send(new ReplyInvestorMail($data));
|
|
}
|
|
return Mail::to($email)->send(new ReplyContactUsMail($data));
|
|
}
|
|
|
|
public function store($request)
|
|
{
|
|
$validated = $request->validated();
|
|
$validated['message'] = $request->reply;
|
|
return ContactUsAdvanced::create($validated);
|
|
}
|
|
|
|
public function view($id)
|
|
{
|
|
return ContactUsAdvanced::with('users')->where('contact_us_id', '=', $id)->get();
|
|
}
|
|
}
|