mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-09-30 06:13:09 -04:00
55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Modules\WTIJobBoard\Http\Controllers;
|
|
|
|
use Illuminate\Contracts\Support\Renderable;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Routing\Controller;
|
|
use Modules\WTIJobBoard\Entities\JobRequest;
|
|
use App\Traits\SendMail;
|
|
|
|
class ClientRelationsController extends Controller
|
|
{
|
|
use SendMail;
|
|
/**
|
|
* Display a listing of the resource.
|
|
* @return Renderable
|
|
*/
|
|
public function index()
|
|
{
|
|
return view('wtijobboard::client-relations');
|
|
}
|
|
|
|
public function send(Request $request)
|
|
{
|
|
if($request->has('job_request_id')){
|
|
|
|
$job_request = JobRequest::find($request->job_request_id);
|
|
if ($job_request) {
|
|
|
|
$response = $this->sendContactClientRelations(auth()->user()->email, auth()->user()->full_name ,json_decode(auth()->user()->wti_data)->brand_name, $job_request->asin, $request->message);
|
|
if($response){
|
|
return response()->json([
|
|
'message' => 'Mail has been sent successfully.'
|
|
]);
|
|
}
|
|
|
|
}
|
|
} else {
|
|
|
|
$response = $this->sendContactClientRelations(auth()->user()->email, auth()->user()->full_name ,null, null, $request->message);
|
|
if($response){
|
|
return response()->json([
|
|
'message' => 'Mail has been sent successfully.'
|
|
]);
|
|
}
|
|
}
|
|
|
|
return response()->json([
|
|
'message' => 'Something went wrong, cannnot send email.'
|
|
], 400);
|
|
}
|
|
|
|
|
|
}
|