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()];
     }
 }
 function create(CreateDomainRequest $request)
 {
     $url = $request->root();
     $url_details = parse_url($url);
     $domain = new Domain();
     $domain->subdomain = $request->domain . '.' . $url_details['host'];
     $domain->host = $request->host;
     $domain->database = $request->dbname;
     $domain->username = $request->username;
     $domain->password = $request->password;
     $domain->prefix = $request->prefix;
     $domain->status = '1';
     $created = $domain->save();
     $result = DB::statement("create database {$request->dbname}");
     if ($created && $result) {
         Config::set('database.connections.newdomain.host', $request->host);
         Config::set('database.connections.newdomain.database', $request->dbname);
         Config::set('database.connections.newdomain.username', $request->username);
         Config::set('database.connections.newdomain.password', $request->password);
         Config::set('database.connections.newdomain.prefix', $request->prefix);
         $status = \Artisan::call('migrate:refresh', ['--force' => true, '--database' => 'newdomain']);
         Config::set('database.connections.subdomain.host', $request->host);
         Config::set('database.connections.subdomain.database', $request->dbname);
         Config::set('database.connections.subdomain.username', $request->username);
         Config::set('database.connections.subdomain.password', $request->password);
         Config::set('database.connections.subdomain.prefix', $request->prefix);
         $status = \Artisan::call('db:seed', ['--force' => true, '--database' => 'subdomain']);
         return \Redirect::to('super/domain')->with('message', 'Your domain has been created!');
     } else {
         return \Redirect::to('super/domain')->with('message', 'Error while creating domain!');
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function bulkStore(Request $request)
 {
     $myDNS = new MyDNS();
     $domains = explode("\n", str_replace("\r", "", $request->get('domains')));
     foreach ($domains as $domain_name) {
         $domain = new Domain();
         $domain->name = $domain_name;
         $domain->fill($request->all());
         $domain->save();
         $this->setRRsTemplate($domain);
         //$domain->setSMTP();
     }
 }
Example #4
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;
 }
Example #5
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $domains = Domain::all();
     foreach ($domains as $domain) {
         $domain->nbr_concepts = count(\DB::table('concept_domain')->where('domain_id', $domain->id)->get());
     }
     return $domains;
 }
Example #6
0
 public function run()
 {
     $domain = Domain::findOrFail(1);
     $values = $domain->services()->get(['finance_bill.name', 'finance_bill.id']);
     $vals = [];
     if ($values) {
         foreach ($values as $v) {
             array_push($vals, $v->name);
         }
     }
     $prompt = [0 => 'Service'];
     $services = array_merge($prompt, $vals);
     return view("widgets.select_service", ['services' => $services]);
 }
Example #7
0
 public function index(Request $request)
 {
     if ($request->get('department')) {
         $services = \App\Service::filterByDepartment($request->get('department'))->get();
         $departments = \App\Department::where('id', $request->get('department'))->get();
     } elseif ($request->get('domain')) {
         $domain = \App\Domain::findOrfail($request->get('domain'));
         $services = $domain->services()->get();
         $departments = $domain->departments()->get();
     } else {
         $services = $this->services;
         $departments = \App\Department::all();
     }
     return view('services.index', ['services' => $services, 'departments' => $departments]);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $subdomain = $request->route()->account;
     $url = $request->root();
     $url_details = parse_url($url);
     $domain = Domain::where('subdomain', $url_details['host'])->where('status', 1)->first();
     if (!$domain) {
         abort(404);
     }
     Config::set('database.connections.subdomain.host', $domain->host);
     Config::set('database.connections.subdomain.database', $domain->database);
     Config::set('database.connections.subdomain.username', $domain->username);
     Config::set('database.connections.subdomain.password', $domain->password);
     Config::set('database.connections.subdomain.prefix', $domain->prefix);
     return $next($request);
 }
 public function findDomain(Request $request)
 {
     $user = $request->user();
     $inputs = $request->only('q');
     $domains = Domain::where('domain', 'LIKE', '%' . $inputs['q'] . '%')->get();
     $search = new Search();
     $search->query = $inputs['q'];
     $search->user_id = $user->id;
     $search->save();
     foreach ($domains as $domain) {
         $result = new Searches_has_domain();
         $result->searches_id = $search->id;
         $result->domains_id = $domain->id;
         $result->save();
     }
     return response()->json($domains);
 }
Example #10
0
 public function getPlayedConcepts(Request $request)
 {
     // get the domain
     $domain = Domain::findOrFail($request->input('id'));
     // Get concepts
     $concepts = $domain->concepts;
     // load associations
     foreach ($concepts as $concept) {
         $concept->load(['associations' => function ($query) {
             $query->where('user_id', Auth::user()->id);
         }]);
     }
     $nbr_concepts = $concepts->count();
     $concepts = $concepts->filter(function ($concept) {
         return $concept->associations->count() > 0;
         // keep only played ones
     });
     $nbr_played_concepts = $concepts->count();
     return Response::json(['concepts' => $concepts, 'nbr_concepts' => $nbr_concepts, 'nbr_played_concepts' => $nbr_played_concepts]);
 }
Example #11
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Domain::create(['domain' => 'interisp.no', 'sld' => 'interisp', 'tld' => 'no', 'orderType' => 'new', 'user_id' => 1]);
     Domain::create(['domain' => 'interisp.net', 'sld' => 'interisp', 'tld' => 'net', 'orderType' => 'new', 'user_id' => 1]);
     Domain::create(['domain' => 'interisp.org', 'sld' => 'interisp', 'tld' => 'org', 'orderType' => 'new', 'user_id' => 1]);
 }
Example #12
0
 /**
  * Treat this method as a controller action.
  * Return view() or other content to display.
  */
 public function run()
 {
     //
     return view("widgets.select_domain", ['domains' => \App\Domain::lists('name', 'id')->toArray()]);
 }
Example #13
0
 public function getAll()
 {
     return Domain::all();
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     // Printout the view //
     $domains = Domain::orderBy('created_at', 'DESC')->paginate(5);
     return view('admin.dashboard')->with('domains', $domains);
 }
Example #15
0
 /**
  * Treat this method as a controller action.
  * Return view() or other content to display.
  */
 public function run()
 {
     return view("widgets.sidemenu", ['domains' => Domain::all()]);
 }
Example #16
0
 /**
  * Delete specified domain via PDNS REST API
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     $domain = Domain::where('user_id', '=', Auth::user()->id)->where('id', '=', $id)->delete();
     if ($domain !== 1) {
         // Domain could not be deleted, either it didn't exist or user did not have permission
         return response('Not found', 404);
     }
     return $domain;
 }
 public function gtopDomains()
 {
     $domains = Domain::select(DB::raw('domains.domain AS label, count(*) AS `value`'))->join('pages', 'domains.id', '=', 'pages.domain_id')->groupBy('domain_id')->orderBy('value', 'desc')->limit(5)->get();
     return response()->json($domains);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $domains = Domain::all();
     return view('domains/index', compact('domains'));
 }
 public function order(Request $request)
 {
     // Data for Domain Model
     $data = ['domain_name' => $request->input('domain_name'), 'domain_type' => $request->input('domain_type'), 'name_servers' => json_encode(['ns1.example.com', 'ns1.example.com']), 'from_ip_address' => $request->ip(), 'domain_status' => 0];
     // Data for Contacts Model
     $contacts = ['Registrant_FirstName' => $request->input('Registrant_FirstName'), 'Registrant_LastName' => $request->input('Registrant_LastName'), 'Registrant_Email' => $request->input('Registrant_Email'), 'Registrant_PhoneNumber' => $request->input('Registrant_PhoneNumber'), 'Registrant_CountryCode' => $request->input('Registrant_CountryCode'), 'Registrant_City' => $request->input('Registrant_City'), 'Registrant_PostalCode' => $request->input('Registrant_PostalCode'), 'Registrant_Street' => $request->input('Registrant_Street')];
     $domain = Domain::create($data);
     // Insert in the database after sending email //
     $contacts['domain_id'] = $domain->id;
     $contacts = Contact::create($contacts);
     // Send Confirmation Email to the administrator and the user //
     $emails = ['*****@*****.**', '*****@*****.**'];
     Mail::send('emails.ordering', ['data' => $request->all()], function ($msg) use($emails, $request) {
         $msg->to($emails, "IRADUKUNDA Blaise Antonio")->subject('Ordering Domain Name : ' . $request->input('domain_name'));
     });
     //Send user confirmation for ordering a domain name on Kplhosting //
     return view('domain.confirm');
 }
Example #20
0
 /**
  * Treat this method as a controller action.
  * Return view() or other content to display.
  */
 public function run()
 {
     //
     return view("widgets.domain_index", ['domains' => \App\Domain::all()]);
 }
Example #21
0
 public function index(Request $request)
 {
     $domain = Domain::findOrFail($request->input('id'));
     $domain->load('profiles.possible_values');
     return $domain->profiles;
 }