您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

BusinessController.php 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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. $otc = 300;
  121. $deposit = $product->deposit;
  122. }else if( $request->subscription == '12' && $voice == 'Yes'){
  123. $otc = 300 + 100;
  124. $deposit = $product->deposit;
  125. }else if($request->subscription == '12' && $request->package != '50Mbps'){
  126. $otc = 400;
  127. $deposit = $product->deposit;
  128. }else {
  129. $otc = 0.0;
  130. $deposit = $product->deposit;
  131. }
  132. $otc_st = number_format(floatval($otc) * 1.06,2);
  133. $upfront_total = number_format(floatval($otc_st) + $deposit,2);
  134. $total = number_format((floatval($product->retail_price) * 1.06) + ($otc * 1.06) + $deposit + $ip_tax, 2);
  135. array_push($data, array(
  136. 'coverage' => $request->coverage,
  137. 'unit' => $request->unit,
  138. 'street' => $request->street,
  139. 'package' => $request->package,
  140. 'application' => $request->application,
  141. 'company_name' => $request->company_name,
  142. 'company_register' => $request->company_register,
  143. 'company_number' => $request->company_number,
  144. 'company_fax' => $request->company_fax,
  145. 'full_name' => $request->full_name,
  146. 'nric_passport' => $request->nric_passport,
  147. 'designation' => $request->designation,
  148. 'contact_primary' => $request->contact_primary,
  149. 'contact_secondary' => $request->contact_secondary,
  150. 'email' => $request->email,
  151. 'subscription' => $request->subscription,
  152. 'billing' => $request->billing,
  153. 'voice' => $voice,
  154. 'ip' => $request->ip,
  155. 'ip_fee' => $ip_fee,
  156. 'ip_tax' => $ip_tax,
  157. 'thedate' => $request->thedate,
  158. ));
  159. return view('sales.form.business_preview', compact('data','coverage','product','deposit','otc', 'otc_st','gst','total_monthly', 'upfront_total'));
  160. }
  161. public function storeFormData(Request $request){
  162. $su_id = ''; $pathIconF = ''; $pathIconB = ''; $pathForm9 = '';
  163. do {
  164. $su_id = strtoupper('CBB-'.$this->random_code(6).'B');
  165. } while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber);
  166. $destinationPath = 'document/'.$su_id;
  167. // create folder/dir if not exist
  168. if(!File::exists(public_path().'/'.$destinationPath)){
  169. File::makeDirectory(public_path().'/'.$destinationPath,0777,true);
  170. }
  171. if($request->hasfile('front_ic')){
  172. $icon = $request->file('front_ic');
  173. $icon->move($destinationPath,'frontic.'.$icon->getClientOriginalExtension());
  174. $pathIconF = '/'.$destinationPath.'/frontic.'.$icon->getClientOriginalExtension();
  175. }
  176. if($request->hasfile('back_ic')){
  177. $icon = $request->file('back_ic');
  178. $icon->move($destinationPath,'backic.'.$icon->getClientOriginalExtension());
  179. $pathIconB = '/'.$destinationPath.'/backic.'.$icon->getClientOriginalExtension();
  180. }
  181. if($request->hasfile('form9')){
  182. $icon = $request->file('form9');
  183. $icon->move($destinationPath,'formD.'.$icon->getClientOriginalExtension());
  184. $pathForm9 = '/'.$destinationPath.'/formD.'.$icon->getClientOriginalExtension();
  185. }
  186. if($pathForm9 != '' && $pathIconB != '' && $pathIconF != ''){
  187. $coverage = Coverage::where('_id',$request->coverage)->first();
  188. $product = Product::where('formT','B')->where('package_name',$request->package)->first();
  189. $sl = Form::create([
  190. 'type_service' => $request->application,
  191. 'type_application' => 'B',
  192. 'project_type' => $coverage->project_type,
  193. 'status_payment' => 'paid',
  194. 'status_email' => 'unverified',
  195. 'remark_form' => ''
  196. ]);
  197. $sdl = new Subscriber();
  198. $sdl->subscriber_id = $su_id;
  199. $sdl->name = $request->full_name;
  200. $sdl->ic = $request->nric_passport;
  201. $sdl->company_name = $request->company_name;
  202. $sdl->company_reg = $request->company_register;
  203. $sdl->company_num = $request->company_number;
  204. $sdl->company_fax = $request->company_fax;
  205. $sdl->designation = $request->designation;
  206. $sdl->email = $request->email;
  207. $sdl->phone1 = $request->contact_primary;
  208. $sdl->phone2 = $request->contact_secondary;
  209. $sdl->unit_no = $request->unit;
  210. $sdl->building_name = $coverage->building_name;
  211. $sdl->street = $request->street;
  212. $sdl->postcode = $coverage->postcode;
  213. $sdl->city = $coverage->city;
  214. $sdl->state = $coverage->state;
  215. $sdl->front_ic = $pathIconF;
  216. $sdl->back_ic = $pathIconB;
  217. $sdl->form9_44 = $pathForm9;
  218. $packageD = new PackageDetail();
  219. $packageD->contract = $request->subscription;
  220. $packageD->name = $product->speed;
  221. if ($request->gst != null){
  222. $packageD->montly_fee = $request->gst;
  223. }else {
  224. $packageD->montly_fee = $request->promo_st;
  225. }
  226. $packageD->voice_fee = $request->voice;
  227. $packageD->ip = $request->ip;
  228. $packageD->deposit = $request->deposit;
  229. $packageD->upfront_payment = $request->otc;
  230. $packageD->ip_tax = $request->ip_tax;
  231. $packageD->rfs = $request->rfs;
  232. $sl->subscriber()->save($sdl);
  233. $sl->packagedetail()->save($packageD);
  234. $f_id = $this->sendInvoice($su_id);
  235. $stat = new FormStatus();
  236. $stat->form_id = $f_id;
  237. $stat->status_id = 1;
  238. $stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
  239. $stat->status = 'Submitted';
  240. $stat->desc = 'The form already been submit';
  241. $sl->formstatus()->save($stat);
  242. return redirect('http://db.citybroadband.my/business/application-form/success-submit');
  243. }
  244. }
  245. /***
  246. ** Dealer
  247. ***/
  248. public function viewFormAddressD($package,$dealer_id) {
  249. $coverage = Coverage::where('Type','B')->orderBy('building_name')->get();
  250. return view('sales.form.dealer.business_address', compact('coverage','package','dealer_id'));
  251. }
  252. public function viewFormApplicationD(Request $request) {
  253. $data = array();
  254. array_push($data, array(
  255. 'coverage' => $request->coverage,
  256. 'unit' => $request->unit,
  257. 'street' => $request->street,
  258. 'package' => $request->package,
  259. 'dealer_id' => $request->dealer_id,
  260. ));
  261. return view('sales.form.dealer.business_application_information', compact('data'));
  262. }
  263. public function viewFormPackageD(Request $request)
  264. {
  265. $data = array();
  266. array_push($data, array(
  267. 'coverage' => $request->coverage,
  268. 'unit' => $request->unit,
  269. 'street' => $request->street,
  270. 'package' => $request->package,
  271. 'application' => $request->application,
  272. 'company_name' => $request->company_name,
  273. 'company_register' => $request->company_register,
  274. 'company_number' => $request->company_number,
  275. 'company_fax' => $request->company_fax,
  276. 'full_name' => $request->full_name,
  277. 'nric_passport' => $request->nric_passport,
  278. 'ip' => $request->ip,
  279. 'designation' => $request->designation,
  280. 'contact_primary' => $request->contact_primary,
  281. 'contact_secondary' => $request->contact_secondary,
  282. 'email' => $request->email,
  283. 'dealer_id' => $request->dealer_id,
  284. ));
  285. $pg = $request->package;
  286. return view('sales.form.dealer.business_package', compact('data','pg'));
  287. }
  288. public function viewFormPreviewD(Request $request){
  289. $data = array();
  290. $coverage = Coverage::where('_id',$request->coverage)->first();
  291. $product = Product::where('formT','B')->where('package_name',$request->package)->first();
  292. $otc = 0.0;
  293. $total_monthly = 0;
  294. $gst ='';
  295. // $promo_st = '';
  296. $voice = "No";
  297. if($request->voice == "Yes"){
  298. $voice = $request->voice;
  299. $voice_price = 20;
  300. }else {
  301. $voice = "No";
  302. $voice_price = 0;
  303. }
  304. $ip_fee = 0; $ip_tax = 0;
  305. if ($request->ip == "1 Fixed IP RM200/1P/Month") {
  306. $ip_fee = 200 ;
  307. $ip_tax = number_format((floatval($ip_fee) * 1.06),2);
  308. }elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
  309. $ip_fee = 400;
  310. $ip_tax = number_format((floatval($ip_fee) * 1.06),2);
  311. }
  312. // if ($request->package != "1Gbps" && $request->subscription == '24'){
  313. // $promo_price = number_format(floatval($product->retail_price) - 10);
  314. // $promo_st = number_format(floatval($promo_price) * 1.06,2);
  315. // $total_monthly = number_format($promo_st + ($voice_price * 1.06) + $ip_tax, 2);
  316. // }
  317. if ($request->package == "1Gbps"){
  318. if ($request->ip == "1 Fixed IP RM200/1P/Month") {
  319. $gst = number_format(floatval($product->retail_price) * 1.06,2);
  320. $total_monthly = 3920.94;
  321. }elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
  322. $gst = number_format(floatval($product->retail_price) * 1.06,2);
  323. $total_monthly = 4132.94;
  324. }else{
  325. $gst = 3708.94;
  326. $total_monthly = 3708.94;
  327. }
  328. }
  329. else{
  330. $gst = number_format(floatval($product->retail_price) * 1.06,2);
  331. $total_monthly = number_format($gst + ($voice_price * 1.06) + $ip_tax, 2);
  332. }
  333. if($request->subscription == '12' && $voice == 'No'){
  334. $otc = 300;
  335. $deposit = $product->deposit;
  336. }else if( $request->subscription == '12' && $voice == 'Yes'){
  337. $otc = 300 + 100;
  338. $deposit = $product->deposit;
  339. }else if($request->subscription == '12' && $request->package != '50Mbps'){
  340. $otc = 400;
  341. $deposit = $product->deposit;
  342. }else {
  343. $otc = 0.0;
  344. $deposit = $product->deposit;
  345. }
  346. $otc_st = number_format(floatval($otc) * 1.06,2);
  347. $upfront_total = number_format(floatval($otc_st) + $deposit,2);
  348. $total = number_format((floatval($product->retail_price) * 1.06) + ($otc * 1.06) + $deposit + $ip_tax, 2);
  349. array_push($data, array(
  350. 'coverage' => $request->coverage,
  351. 'unit' => $request->unit,
  352. 'street' => $request->street,
  353. 'package' => $request->package,
  354. 'application' => $request->application,
  355. 'company_name' => $request->company_name,
  356. 'company_register' => $request->company_register,
  357. 'company_number' => $request->company_number,
  358. 'company_fax' => $request->company_fax,
  359. 'full_name' => $request->full_name,
  360. 'nric_passport' => $request->nric_passport,
  361. 'designation' => $request->designation,
  362. 'contact_primary' => $request->contact_primary,
  363. 'contact_secondary' => $request->contact_secondary,
  364. 'email' => $request->email,
  365. 'subscription' => $request->subscription,
  366. 'billing' => $request->billing,
  367. 'voice' => $voice,
  368. 'ip' => $request->ip,
  369. 'ip_fee' => $ip_fee,
  370. 'ip_tax' => $ip_tax,
  371. 'thedate' => $request->thedate,
  372. 'dealer_id' => $request->dealer_id,
  373. ));
  374. return view('sales.form.dealer.business_preview', compact('data','coverage','product','deposit','otc', 'otc_st','gst','total_monthly', 'upfront_total'));
  375. }
  376. public function storeFormDataD(Request $request){
  377. $su_id = ''; $pathIconF = ''; $pathIconB = ''; $pathForm9 = ''; $pathPaymentReceipt = ''; $pathSoForm = '';
  378. do {
  379. $su_id = strtoupper('CBB-'.$this->random_code(6).'B');
  380. } while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber);
  381. $destinationPath = 'document/'.$su_id;
  382. // create folder/dir if not exist
  383. if(!File::exists(public_path().'/'.$destinationPath)){
  384. File::makeDirectory(public_path().'/'.$destinationPath,0777,true);
  385. }
  386. if($request->hasfile('front_ic')){
  387. $icon = $request->file('front_ic');
  388. $icon->move($destinationPath,'frontic.'.$icon->getClientOriginalExtension());
  389. $pathIconF = '/'.$destinationPath.'/frontic.'.$icon->getClientOriginalExtension();
  390. }
  391. if($request->hasfile('back_ic')){
  392. $icon = $request->file('back_ic');
  393. $icon->move($destinationPath,'backic.'.$icon->getClientOriginalExtension());
  394. $pathIconB = '/'.$destinationPath.'/backic.'.$icon->getClientOriginalExtension();
  395. }
  396. if($request->hasfile('form9')){
  397. $icon = $request->file('form9');
  398. $icon->move($destinationPath,'formD.'.$icon->getClientOriginalExtension());
  399. $pathForm9 = '/'.$destinationPath.'/formD.'.$icon->getClientOriginalExtension();
  400. }
  401. if($request->hasfile('paymentReceipt')){
  402. $icon = $request->file('paymentReceipt');
  403. $icon->move($destinationPath,'paymentReceipt.'.$icon->getClientOriginalExtension());
  404. $pathPaymentReceipt = '/'.$destinationPath.'/paymentReceipt.'.$icon->getClientOriginalExtension();
  405. }
  406. if($request->hasfile('soForm')){
  407. $icon = $request->file('soForm');
  408. $icon->move($destinationPath,'soForm.'.$icon->getClientOriginalExtension());
  409. $pathSoForm = '/'.$destinationPath.'/soForm.'.$icon->getClientOriginalExtension();
  410. }
  411. if($pathForm9 != '' && $pathIconB != '' && $pathIconF != ''){
  412. $staff = Staff::with('StaffDetail')->where('_id',$request->dealer_id)->first();
  413. if(!empty($staff)){
  414. $coverage = Coverage::where('_id',$request->coverage)->first();
  415. $product = Product::where('formT','B')->where('package_name',$request->package)->first();
  416. $sl = new Form();
  417. $sl->type_service = $request->application;
  418. $sl->type_application = 'B';
  419. $sl->project_type = $coverage->project_type;
  420. $sl->status_payment = 'paid';
  421. $sl->status_email = 'unverified';
  422. $sl->remark_form = '';
  423. $sl->dealer_id = $request->dealer_id;
  424. $sl->company_id = $staff->StaffDetail->company_id;
  425. $staff->form()->save($sl);
  426. $sdl = new Subscriber();
  427. $sdl->subscriber_id = $su_id;
  428. $sdl->name = $request->full_name;
  429. $sdl->ic = $request->nric_passport;
  430. $sdl->company_name = $request->company_name;
  431. $sdl->company_reg = $request->company_register;
  432. $sdl->company_num = $request->company_number;
  433. $sdl->company_fax = $request->company_fax;
  434. $sdl->designation = $request->designation;
  435. $sdl->email = $request->email;
  436. $sdl->phone1 = $request->contact_primary;
  437. $sdl->phone2 = $request->contact_secondary;
  438. $sdl->unit_no = $request->unit;
  439. $sdl->building_name = $coverage->building_name;
  440. $sdl->street = $request->street;
  441. $sdl->postcode = $coverage->postcode;
  442. $sdl->city = $coverage->city;
  443. $sdl->state = $coverage->state;
  444. $sdl->front_ic = $pathIconF;
  445. $sdl->back_ic = $pathIconB;
  446. $sdl->form9_44 = $pathForm9;
  447. $sdl->paymentReceipt = $pathPaymentReceipt;
  448. $sdl->soForm = $pathSoForm;
  449. $packageD = new PackageDetail();
  450. $packageD->contract = $request->subscription;
  451. $packageD->name = $product->speed;
  452. if ($request->gst != null){
  453. $packageD->montly_fee = $request->gst;
  454. }else {
  455. $packageD->montly_fee = $request->promo_st;
  456. }
  457. $packageD->voice_fee = $request->voice;
  458. $packageD->ip = $request->ip;
  459. $packageD->ip_tax = $request->ip_tax;
  460. $packageD->deposit = $request->deposit;
  461. $packageD->upfront_payment = $request->otc;
  462. $packageD->rfs = $request->rfs;
  463. $sl->subscriber()->save($sdl);
  464. $sl->packagedetail()->save($packageD);
  465. $f_id = $this->sendInvoice($su_id);
  466. $stat = new FormStatus();
  467. $stat->form_id = $f_id;
  468. $stat->status_id = 1;
  469. $stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
  470. $stat->status = 'Submitted';
  471. $stat->desc = 'The form already been submit';
  472. $sl->formstatus()->save($stat);
  473. return redirect('http://db.citybroadband.my/business/application-form/success-submit');
  474. }
  475. }
  476. }
  477. public function verifyEmail($subscriber_id){
  478. $subscriber = Subscriber::where('subscriber_id',$subscriber_id)->first();
  479. if(!empty($subscriber)){
  480. $form = Form::where('_id',$subscriber->_id)->first();
  481. if(!empty($form)){
  482. if($form->status_email == 'unverified'){
  483. $form->status_email = 'verified';
  484. $form->save();
  485. $stat = new FormStatus();
  486. $stat->form_id = $form->_id;
  487. $stat->status_id = 2;
  488. $stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
  489. $stat->status = 'Verified';
  490. $stat->desc = 'Email already been verified by customer';
  491. $form->formstatus()->save($stat);
  492. return redirect('http://db.citybroadband.my/business/application-form/success-verified');
  493. }
  494. }
  495. }
  496. }
  497. public function checkEmailTemplate($subscriber_id){
  498. $subscriber = Subscriber::where('subscriber_id',$subscriber_id)->first();
  499. if(!empty($subscriber)){
  500. $form = Form::where('_id',$subscriber->_id)->first();
  501. $product = Product::where('speed',$form->PackageDetail->name)->where('formT',$form->type_application)->first();
  502. }
  503. return view('email.invoiceb', compact ('form', 'product'));
  504. }
  505. }