Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

BusinessController.php 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. <?php
  2. namespace App\Http\Controllers\Form;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use Illuminate\Support\Facades\Auth;
  6. use App\Mail\CustomerBInvoice;
  7. use App\Jobs\SendCustomerInvoiceB;
  8. use Carbon\Carbon;
  9. use Validator;
  10. use File;
  11. use App\Model\Coverage;
  12. use App\Model\Product;
  13. use App\Model\Form;
  14. use App\Model\Subscriber;
  15. use App\Model\PackageDetail;
  16. use App\Model\FormStatus;
  17. use App\Staff;
  18. use App\Model\StaffDetail;
  19. class BusinessController extends Controller
  20. {
  21. public function successSubmit(){
  22. return view('sales.form.after_submit_form');
  23. }
  24. public function successVerified(){
  25. return view('sales.form.success_verify');
  26. }
  27. public function sendInvoice($subscriber_id) {
  28. $subscriber = Subscriber::with('Form')->where('subscriber_id',$subscriber_id)->first();
  29. $form = Form::with('Subscriber','PackageDetail')->where('_id',$subscriber->_id)->first();
  30. $product = Product::where('speed',$form->PackageDetail->name)->where('formT',$form->type_application)->first();
  31. SendCustomerInvoiceB::dispatch($form, $product, $form->Subscriber->email);
  32. return $form->_id;
  33. }
  34. function random_code($limit) {
  35. return substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, $limit);
  36. }
  37. public function viewFormAddress($package) {
  38. $dealer_id = '';
  39. $coverage = Coverage::where('Type','B')->orderBy('building_name')->get();
  40. return view('sales.form.business_address', compact('coverage','package','dealer_id'));
  41. }
  42. public function viewFormApplication(Request $request) {
  43. $data = array();
  44. array_push($data, array(
  45. 'coverage' => $request->coverage,
  46. 'unit' => $request->unit,
  47. 'street' => $request->street,
  48. 'package' => $request->package
  49. ));
  50. return view('sales.form.business_application_information', compact('data'));
  51. }
  52. public function viewFormPackage(Request $request)
  53. {
  54. $data = array();
  55. array_push($data, array(
  56. 'coverage' => $request->coverage,
  57. 'unit' => $request->unit,
  58. 'street' => $request->street,
  59. 'package' => $request->package,
  60. 'application' => $request->application,
  61. 'company_name' => $request->company_name,
  62. 'company_register' => $request->company_register,
  63. 'company_number' => $request->company_number,
  64. 'company_fax' => $request->company_fax,
  65. 'full_name' => $request->full_name,
  66. 'nric_passport' => $request->nric_passport,
  67. 'designation' => $request->designation,
  68. 'contact_primary' => $request->contact_primary,
  69. 'contact_secondary' => $request->contact_secondary,
  70. 'email' => $request->email,
  71. ));
  72. $pg = $request->package;
  73. return view('sales.form.business_package', compact('data','pg'));
  74. }
  75. public function viewFormPreview(Request $request){
  76. $data = array();
  77. $coverage = Coverage::where('_id',$request->coverage)->first();
  78. $product = Product::where('formT','B')->where('package_name',$request->package)->first();
  79. $otc = 0.0;
  80. $total_monthly = 0;
  81. $gst ='';
  82. // $promo_st = '';
  83. $voice = "No";
  84. if($request->voice == "Yes"){
  85. $voice = $request->voice;
  86. $voice_price = 20;
  87. }else {
  88. $voice = "No";
  89. $voice_price = 0;
  90. }
  91. $ip_fee = 0; $ip_tax = 0;
  92. if ($request->ip == "1 Fixed IP RM200/1P/Month") {
  93. $ip_fee = 200 ;
  94. $ip_tax = number_format((floatval($ip_fee) * 1.06),2);
  95. }elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
  96. $ip_fee = 400;
  97. $ip_tax = number_format((floatval($ip_fee) * 1.06),2);
  98. }
  99. // if ($request->package != "1Gbps" && $request->subscription == '24'){
  100. // $promo_price = number_format(floatval($product->retail_price) - 10);
  101. // $promo_st = number_format(floatval($promo_price) * 1.06,2);
  102. // $total_monthly = number_format($promo_st + ($voice_price * 1.06) + $ip_tax, 2);
  103. // }
  104. if ($request->package == "1Gbps"){
  105. if ($request->ip == "1 Fixed IP RM200/1P/Month") {
  106. $gst = number_format(floatval($product->retail_price) * 1.06,2);
  107. $total_monthly = 3920.94;
  108. }elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
  109. $gst = number_format(floatval($product->retail_price) * 1.06,2);
  110. $total_monthly = 4132.94;
  111. }else{
  112. $gst = 3708.94;
  113. $total_monthly = 3708.94;
  114. }
  115. }else{
  116. $gst = number_format(floatval($product->retail_price) * 1.06,2);
  117. $total_monthly = number_format($gst + ($voice_price * 1.06) + $ip_tax, 2);
  118. }
  119. if($request->subscription == '12' && $voice == 'No'){
  120. if ($request->package != '50Mbps'){
  121. $otc = 400;
  122. }else {
  123. $otc = 300;
  124. }
  125. $deposit = $product->deposit;
  126. }else if( $request->subscription == '12' && $voice == 'Yes'){
  127. $otc = 300 + 100;
  128. $deposit = $product->deposit;
  129. }else {
  130. $otc = 0.0;
  131. $deposit = $product->deposit;
  132. }
  133. $otc_st = number_format(floatval($otc) * 1.06,2);
  134. $upfront_total = number_format(floatval($otc_st) + $deposit,2);
  135. $total = number_format((floatval($product->retail_price) * 1.06) + ($otc * 1.06) + $deposit + $ip_tax, 2);
  136. array_push($data, array(
  137. 'coverage' => $request->coverage,
  138. 'unit' => $request->unit,
  139. 'street' => $request->street,
  140. 'package' => $request->package,
  141. 'application' => $request->application,
  142. 'company_name' => $request->company_name,
  143. 'company_register' => $request->company_register,
  144. 'company_number' => $request->company_number,
  145. 'company_fax' => $request->company_fax,
  146. 'full_name' => $request->full_name,
  147. 'nric_passport' => $request->nric_passport,
  148. 'designation' => $request->designation,
  149. 'contact_primary' => $request->contact_primary,
  150. 'contact_secondary' => $request->contact_secondary,
  151. 'email' => $request->email,
  152. 'subscription' => $request->subscription,
  153. 'billing' => $request->billing,
  154. 'voice' => $voice,
  155. 'ip' => $request->ip,
  156. 'ip_fee' => $ip_fee,
  157. 'ip_tax' => $ip_tax,
  158. 'thedate' => $request->thedate,
  159. ));
  160. return view('sales.form.business_preview', compact('data','coverage','product','deposit','otc', 'otc_st','gst','total_monthly', 'upfront_total'));
  161. }
  162. public function storeFormData(Request $request){
  163. $su_id = ''; $pathIconF = ''; $pathIconB = ''; $pathForm9 = '';
  164. do {
  165. $su_id = strtoupper('CBB-'.$this->random_code(6).'B');
  166. } while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber);
  167. $destinationPath = 'document/'.$su_id;
  168. // create folder/dir if not exist
  169. if(!File::exists(public_path().'/'.$destinationPath)){
  170. File::makeDirectory(public_path().'/'.$destinationPath,0777,true);
  171. }
  172. if($request->hasfile('front_ic')){
  173. $icon = $request->file('front_ic');
  174. $icon->move($destinationPath,'frontic.'.$icon->getClientOriginalExtension());
  175. $pathIconF = '/'.$destinationPath.'/frontic.'.$icon->getClientOriginalExtension();
  176. }
  177. if($request->hasfile('back_ic')){
  178. $icon = $request->file('back_ic');
  179. $icon->move($destinationPath,'backic.'.$icon->getClientOriginalExtension());
  180. $pathIconB = '/'.$destinationPath.'/backic.'.$icon->getClientOriginalExtension();
  181. }
  182. if($request->hasfile('form9')){
  183. $icon = $request->file('form9');
  184. $icon->move($destinationPath,'formD.'.$icon->getClientOriginalExtension());
  185. $pathForm9 = '/'.$destinationPath.'/formD.'.$icon->getClientOriginalExtension();
  186. }
  187. if($pathForm9 != '' && $pathIconB != '' && $pathIconF != ''){
  188. $coverage = Coverage::where('_id',$request->coverage)->first();
  189. $product = Product::where('formT','B')->where('package_name',$request->package)->first();
  190. $sl = Form::create([
  191. 'type_service' => $request->application,
  192. 'type_application' => 'B',
  193. 'project_type' => $coverage->project_type,
  194. 'status_payment' => 'paid',
  195. 'status_email' => 'unverified',
  196. 'customer_coverage' => 'Allo',
  197. 'remark_form' => ''
  198. ]);
  199. $sdl = new Subscriber();
  200. $sdl->subscriber_id = $su_id;
  201. $sdl->name = $request->full_name;
  202. $sdl->ic = $request->nric_passport;
  203. $sdl->company_name = $request->company_name;
  204. $sdl->company_reg = $request->company_register;
  205. $sdl->company_num = $request->company_number;
  206. $sdl->company_fax = $request->company_fax;
  207. $sdl->designation = $request->designation;
  208. $sdl->email = $request->email;
  209. $sdl->phone1 = $request->contact_primary;
  210. $sdl->phone2 = $request->contact_secondary;
  211. $sdl->unit_no = $request->unit;
  212. $sdl->building_name = $coverage->building_name;
  213. $sdl->street = $request->street;
  214. $sdl->postcode = $coverage->postcode;
  215. $sdl->city = $coverage->city;
  216. $sdl->state = $coverage->state;
  217. $sdl->front_ic = $pathIconF;
  218. $sdl->back_ic = $pathIconB;
  219. $sdl->form9_44 = $pathForm9;
  220. $packageD = new PackageDetail();
  221. $packageD->contract = $request->subscription;
  222. $packageD->name = $product->speed;
  223. if ($request->gst != null){
  224. $packageD->montly_fee = $request->gst;
  225. }else {
  226. $packageD->montly_fee = $request->promo_st;
  227. }
  228. $packageD->voice_fee = $request->voice;
  229. $packageD->ip = $request->ip;
  230. $packageD->deposit = $request->deposit;
  231. $packageD->upfront_payment = $request->otc;
  232. $packageD->ip_tax = $request->ip_tax;
  233. $packageD->rfs = $request->rfs;
  234. $sl->subscriber()->save($sdl);
  235. $sl->packagedetail()->save($packageD);
  236. $f_id = $this->sendInvoice($su_id);
  237. $stat = new FormStatus();
  238. $stat->form_id = $f_id;
  239. $stat->status_id = 1;
  240. $stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
  241. $stat->status = 'Submitted';
  242. $stat->desc = 'The form already been submit';
  243. $sl->formstatus()->save($stat);
  244. return redirect('http://db.citybroadband.my/business/application-form/success-submit');
  245. }
  246. }
  247. /***
  248. ** Dealer
  249. ***/
  250. public function viewFormAddressD($package,$dealer_id) {
  251. $coverage = Coverage::where('Type','B')->orderBy('building_name')->get();
  252. return view('sales.form.dealer.business_address', compact('coverage','package','dealer_id'));
  253. }
  254. public function viewFormApplicationD(Request $request) {
  255. $data = array();
  256. array_push($data, array(
  257. 'coverage' => $request->coverage,
  258. 'unit' => $request->unit,
  259. 'street' => $request->street,
  260. 'package' => $request->package,
  261. 'dealer_id' => $request->dealer_id,
  262. ));
  263. return view('sales.form.dealer.business_application_information', compact('data'));
  264. }
  265. public function viewFormPackageD(Request $request)
  266. {
  267. $data = array();
  268. array_push($data, array(
  269. 'coverage' => $request->coverage,
  270. 'unit' => $request->unit,
  271. 'street' => $request->street,
  272. 'package' => $request->package,
  273. 'application' => $request->application,
  274. 'company_name' => $request->company_name,
  275. 'company_register' => $request->company_register,
  276. 'company_number' => $request->company_number,
  277. 'company_fax' => $request->company_fax,
  278. 'full_name' => $request->full_name,
  279. 'nric_passport' => $request->nric_passport,
  280. 'ip' => $request->ip,
  281. 'designation' => $request->designation,
  282. 'contact_primary' => $request->contact_primary,
  283. 'contact_secondary' => $request->contact_secondary,
  284. 'email' => $request->email,
  285. 'dealer_id' => $request->dealer_id,
  286. ));
  287. $pg = $request->package;
  288. return view('sales.form.dealer.business_package', compact('data','pg'));
  289. }
  290. public function viewFormPreviewD(Request $request){
  291. $data = array();
  292. $coverage = Coverage::where('_id',$request->coverage)->first();
  293. $product = Product::where('formT','B')->where('package_name',$request->package)->first();
  294. $otc = 0.0;
  295. $total_monthly = 0;
  296. $gst ='';
  297. // $promo_st = '';
  298. $voice = "No";
  299. if($request->voice == "Yes"){
  300. $voice = $request->voice;
  301. $voice_price = 20;
  302. }else {
  303. $voice = "No";
  304. $voice_price = 0;
  305. }
  306. $ip_fee = 0; $ip_tax = 0;
  307. if ($request->ip == "1 Fixed IP RM200/1P/Month") {
  308. $ip_fee = 200 ;
  309. $ip_tax = number_format((floatval($ip_fee) * 1.06),2);
  310. }elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
  311. $ip_fee = 400;
  312. $ip_tax = number_format((floatval($ip_fee) * 1.06),2);
  313. }
  314. // if ($request->package != "1Gbps" && $request->subscription == '24'){
  315. // $promo_price = number_format(floatval($product->retail_price) - 10);
  316. // $promo_st = number_format(floatval($promo_price) * 1.06,2);
  317. // $total_monthly = number_format($promo_st + ($voice_price * 1.06) + $ip_tax, 2);
  318. // }
  319. if ($request->package == "1Gbps"){
  320. if ($request->ip == "1 Fixed IP RM200/1P/Month") {
  321. $gst = number_format(floatval($product->retail_price) * 1.06,2);
  322. $total_monthly = 3920.94;
  323. }elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
  324. $gst = number_format(floatval($product->retail_price) * 1.06,2);
  325. $total_monthly = 4132.94;
  326. }else{
  327. $gst = 3708.94;
  328. $total_monthly = 3708.94;
  329. }
  330. }
  331. else{
  332. $gst = number_format(floatval($product->retail_price) * 1.06,2);
  333. $total_monthly = number_format($gst + ($voice_price * 1.06) + $ip_tax, 2);
  334. }
  335. if($request->subscription == '12' && $voice == 'No'){
  336. if ($request->package != '50Mbps'){
  337. $otc = 400;
  338. }else {
  339. $otc = 300;
  340. }
  341. $deposit = $product->deposit;
  342. }else if( $request->subscription == '12' && $voice == 'Yes'){
  343. $otc = 300 + 100;
  344. $deposit = $product->deposit;
  345. }else if($request->subscription == '12' && $request->package != '50Mbps'){
  346. $otc = 400;
  347. $deposit = $product->deposit;
  348. }else {
  349. $otc = 0.0;
  350. $deposit = $product->deposit;
  351. }
  352. $otc_st = number_format(floatval($otc) * 1.06,2);
  353. $upfront_total = number_format(floatval($otc_st) + $deposit,2);
  354. $total = number_format((floatval($product->retail_price) * 1.06) + ($otc * 1.06) + $deposit + $ip_tax, 2);
  355. array_push($data, array(
  356. 'coverage' => $request->coverage,
  357. 'unit' => $request->unit,
  358. 'street' => $request->street,
  359. 'package' => $request->package,
  360. 'application' => $request->application,
  361. 'company_name' => $request->company_name,
  362. 'company_register' => $request->company_register,
  363. 'company_number' => $request->company_number,
  364. 'company_fax' => $request->company_fax,
  365. 'full_name' => $request->full_name,
  366. 'nric_passport' => $request->nric_passport,
  367. 'designation' => $request->designation,
  368. 'contact_primary' => $request->contact_primary,
  369. 'contact_secondary' => $request->contact_secondary,
  370. 'email' => $request->email,
  371. 'subscription' => $request->subscription,
  372. 'billing' => $request->billing,
  373. 'voice' => $voice,
  374. 'ip' => $request->ip,
  375. 'ip_fee' => $ip_fee,
  376. 'ip_tax' => $ip_tax,
  377. 'thedate' => $request->thedate,
  378. 'dealer_id' => $request->dealer_id,
  379. ));
  380. return view('sales.form.dealer.business_preview', compact('data','coverage','product','deposit','otc', 'otc_st','gst','total_monthly', 'upfront_total'));
  381. }
  382. public function storeFormDataD(Request $request){
  383. $su_id = ''; $pathIconF = ''; $pathIconB = ''; $pathForm9 = ''; $pathPaymentReceipt = ''; $pathSoForm = '';
  384. do {
  385. $su_id = strtoupper('CBB-'.$this->random_code(6).'B');
  386. } while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber);
  387. $destinationPath = 'document/'.$su_id;
  388. // create folder/dir if not exist
  389. if(!File::exists(public_path().'/'.$destinationPath)){
  390. File::makeDirectory(public_path().'/'.$destinationPath,0777,true);
  391. }
  392. if($request->hasfile('front_ic')){
  393. $icon = $request->file('front_ic');
  394. $icon->move($destinationPath,'frontic.'.$icon->getClientOriginalExtension());
  395. $pathIconF = '/'.$destinationPath.'/frontic.'.$icon->getClientOriginalExtension();
  396. }
  397. if($request->hasfile('back_ic')){
  398. $icon = $request->file('back_ic');
  399. $icon->move($destinationPath,'backic.'.$icon->getClientOriginalExtension());
  400. $pathIconB = '/'.$destinationPath.'/backic.'.$icon->getClientOriginalExtension();
  401. }
  402. if($request->hasfile('form9')){
  403. $icon = $request->file('form9');
  404. $icon->move($destinationPath,'formD.'.$icon->getClientOriginalExtension());
  405. $pathForm9 = '/'.$destinationPath.'/formD.'.$icon->getClientOriginalExtension();
  406. }
  407. if($request->hasfile('paymentReceipt')){
  408. $icon = $request->file('paymentReceipt');
  409. $icon->move($destinationPath,'paymentReceipt.'.$icon->getClientOriginalExtension());
  410. $pathPaymentReceipt = '/'.$destinationPath.'/paymentReceipt.'.$icon->getClientOriginalExtension();
  411. }
  412. if($request->hasfile('soForm')){
  413. $icon = $request->file('soForm');
  414. $icon->move($destinationPath,'soForm.'.$icon->getClientOriginalExtension());
  415. $pathSoForm = '/'.$destinationPath.'/soForm.'.$icon->getClientOriginalExtension();
  416. }
  417. if($pathForm9 != '' && $pathIconB != '' && $pathIconF != ''){
  418. $staff = Staff::with('StaffDetail')->where('_id',$request->dealer_id)->first();
  419. if(!empty($staff)){
  420. $coverage = Coverage::where('_id',$request->coverage)->first();
  421. $product = Product::where('formT','B')->where('package_name',$request->package)->first();
  422. $sl = new Form();
  423. $sl->type_service = $request->application;
  424. $sl->type_application = 'B';
  425. $sl->project_type = $coverage->project_type;
  426. $sl->status_payment = 'paid';
  427. $sl->status_email = 'unverified';
  428. $sl->customer_coverage = 'Allo';
  429. $sl->remark_form = '';
  430. $sl->dealer_id = $request->dealer_id;
  431. $sl->company_id = $staff->StaffDetail->company_id;
  432. $staff->form()->save($sl);
  433. $sdl = new Subscriber();
  434. $sdl->subscriber_id = $su_id;
  435. $sdl->name = $request->full_name;
  436. $sdl->ic = $request->nric_passport;
  437. $sdl->company_name = $request->company_name;
  438. $sdl->company_reg = $request->company_register;
  439. $sdl->company_num = $request->company_number;
  440. $sdl->company_fax = $request->company_fax;
  441. $sdl->designation = $request->designation;
  442. $sdl->email = $request->email;
  443. $sdl->phone1 = $request->contact_primary;
  444. $sdl->phone2 = $request->contact_secondary;
  445. $sdl->unit_no = $request->unit;
  446. $sdl->building_name = $coverage->building_name;
  447. $sdl->street = $request->street;
  448. $sdl->postcode = $coverage->postcode;
  449. $sdl->city = $coverage->city;
  450. $sdl->state = $coverage->state;
  451. $sdl->front_ic = $pathIconF;
  452. $sdl->back_ic = $pathIconB;
  453. $sdl->form9_44 = $pathForm9;
  454. $sdl->paymentReceipt = $pathPaymentReceipt;
  455. $sdl->soForm = $pathSoForm;
  456. $packageD = new PackageDetail();
  457. $packageD->contract = $request->subscription;
  458. $packageD->name = $product->speed;
  459. if ($request->gst != null){
  460. $packageD->montly_fee = $request->gst;
  461. }else {
  462. $packageD->montly_fee = $request->promo_st;
  463. }
  464. $packageD->voice_fee = $request->voice;
  465. $packageD->ip = $request->ip;
  466. $packageD->ip_tax = $request->ip_tax;
  467. $packageD->deposit = $request->deposit;
  468. $packageD->upfront_payment = $request->otc;
  469. $packageD->rfs = $request->rfs;
  470. $sl->subscriber()->save($sdl);
  471. $sl->packagedetail()->save($packageD);
  472. $f_id = $this->sendInvoice($su_id);
  473. $stat = new FormStatus();
  474. $stat->form_id = $f_id;
  475. $stat->status_id = 1;
  476. $stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
  477. $stat->status = 'Submitted';
  478. $stat->desc = 'The form already been submit';
  479. $sl->formstatus()->save($stat);
  480. return redirect('http://db.citybroadband.my/business/application-form/success-submit');
  481. }
  482. }
  483. }
  484. public function verifyEmail($subscriber_id){
  485. $subscriber = Subscriber::where('subscriber_id',$subscriber_id)->first();
  486. if(!empty($subscriber)){
  487. $form = Form::where('_id',$subscriber->_id)->first();
  488. if(!empty($form)){
  489. if($form->status_email == 'unverified'){
  490. $form->status_email = 'verified';
  491. $form->save();
  492. $stat = new FormStatus();
  493. $stat->form_id = $form->_id;
  494. $stat->status_id = 2;
  495. $stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
  496. $stat->status = 'Verified';
  497. $stat->desc = 'Email already been verified by customer';
  498. $form->formstatus()->save($stat);
  499. return redirect('http://db.citybroadband.my/business/application-form/success-verified');
  500. }
  501. }
  502. }
  503. }
  504. public function resendEmail($subscriber_id){
  505. $f_id = $this->sendInvoice($subscriber_id);
  506. return $f_id;
  507. }
  508. public function checkEmailTemplate($subscriber_id){
  509. $subscriber = Subscriber::where('subscriber_id',$subscriber_id)->first();
  510. if(!empty($subscriber)){
  511. $form = Form::where('_id',$subscriber->_id)->first();
  512. $product = Product::where('speed',$form->PackageDetail->name)->where('formT',$form->type_application)->first();
  513. }
  514. return view('email.invoiceb', compact ('form', 'product'));
  515. }
  516. }