%PDF- %PDF-
Direktori : /home/silvzytp/calling_code/app/Http/Controllers/Backend/ |
Current File : //home/silvzytp/calling_code/app/Http/Controllers/Backend/SupportController.php |
<?php namespace App\Http\Controllers\Backend; use App\Mail\SupportMail; use Illuminate\Http\Request; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Mail; use App\Http\Requests\SupportRequest; use Illuminate\Support\Facades\DB; class SupportController extends Controller { public function support(SupportRequest $request){ if ($request->ajax()) { DB::beginTransaction(); $mailContent = [ 'subject'=>$request->subject, 'message'=>$request->message ]; try { Mail::to('it@silveroak.ae') ->cc('itsupport@silveroak.ae') ->later(now()->addSeconds(10), new SupportMail($mailContent)); $output = ['status'=>'success','message'=>'Support ticket successful.']; DB::commit(); } catch (\Exception $e) { DB::rollBack(); $output = ['status'=>'error','message'=>$e->getMessage()]; } return response()->json($output); } } }