public function intlDomain(Request $request)
 {
     $data = $request->all();
     $contacts = (object) $data['contacts'];
     //Registrant Contact Array
     $registrant = ['Firstname' => $contacts->Registrant_FirstName, 'Lastname' => $contacts->Registrant_LastName, 'Organization' => 'My Company', 'CountryCode' => $contacts->Registrant_CountryCode, 'City' => $contacts->Registrant_City, 'Email' => $contacts->Registrant_Email, 'Street' => $contacts->Registrant_Street, 'PostalCode' => $contacts->Registrant_PostalCode, 'PhoneNumber' => $this->intlphoneNumber($contacts->Registrant_PhoneNumber, $contacts->Registrant_CountryCode)];
     // Admin Contact Array
     $admin = ['Firstname' => $contacts->Admin_FirstName, 'Lastname' => $contacts->Admin_LastName, 'Organization' => 'My Company', 'CountryCode' => $contacts->Admin_CountryCode, 'City' => $contacts->Admin_City, 'Email' => $contacts->Admin_Email, 'Street' => $contacts->Admin_Street, 'PostalCode' => $contacts->Admin_PostalCode, 'PhoneNumber' => $this->intlphoneNumber($contacts->Registrant_PhoneNumber, $contacts->Registrant_CountryCode)];
     $c = array('Registrant' => $registrant, 'Admin' => $admin, 'Technical' => $admin, 'Billing' => $admin);
     $nameservers = ['Ns_list' => implode(',', $data['name_servers'])];
     try {
         InternetBS::init('X1A7S0D7X8N0U0U0I6S2', 'Toto197500cxz');
         if (Domain::find($data['domain_id'])->domain_status == 0) {
             $response = (object) json_decode(InternetBS::api()->domainCreate($data['domain_name'], $c, 1, $nameservers));
             if ($response->product[0]->status == 'SUCCESS') {
                 $domain = Domain::find($data->domain_id);
                 $domain->domain_status = 1;
                 $domain->save();
                 // Send an email of confirmation and do a redirection automatically
                 return redirect('admin/dashboard');
             } else {
                 // Redict to error page
                 return redirect('admin/errors');
             }
         } else {
             // Update Domain Name //
             InternetBS::api()->domainAssignNS($data['domain_name'], $data['name_servers']);
             $updates = InternetBS::api()->domainUpdate($data['domain_name'], $c);
             return ['response' => $updates];
         }
     } catch (Exception $e) {
         return ['response' => 'error detected', 'error_msg' => $e->getMessage()];
     }
 }
示例#2
0
 public function get(Request $request)
 {
     $id = null != $request->input('id') ? $request->input('id') : 1;
     $domain = App\Domain::find($request->input('id'));
     $outcomes = $domain->outcomes()->where('status', Outcome::STATUS_TODO)->whereNull('outcome_id')->get();
     $outcomes->load('outcomes.todos');
     // load todos
     $outcomes->load('todos');
     foreach ($outcomes as $outcome) {
         $notyet = false;
         foreach ($outcome->outcomes as $out) {
             if ($out->todos->count() > 0 && $out->todos()->notdone()->get()->count() == 0) {
                 $out->status = 1;
             } else {
                 $out->status = 0;
                 $notyet = true;
             }
         }
         $outcome->status = 0;
         if ($outcome->todos->count() > 0 && $outcome->todos()->notdone()->get()->count() == 0 && !$notyet) {
             $outcome->status = 1;
         }
     }
     return $outcomes;
 }
示例#3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     if (!Input::has('domain')) {
         return response('Required fields missing from request.', 400);
     }
     $input = Input::all();
     $domain = Domain::find($id);
     $domain->user_id = Auth::user()->id;
     $domain->domain = Input::get('domain');
     $domain->save();
     return $domain;
 }