From 54a1eb617ec14c4514e5f081aaf0e1d8ea0e5a84 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Fri, 30 Mar 2018 09:52:08 -0400 Subject: [PATCH] Create Zone --- app/Http/Controllers/PagesController.php | 71 +++++++++++++++++++++++- resources/views/createzone.blade.php | 2 +- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/PagesController.php b/app/Http/Controllers/PagesController.php index 410a4da..77263b0 100644 --- a/app/Http/Controllers/PagesController.php +++ b/app/Http/Controllers/PagesController.php @@ -6,7 +6,8 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; use View; Use App\helpers; - +use GuzzleHttp\Exception\GuzzleException; +use GuzzleHttp\Client; class PagesController extends Controller { @@ -16,7 +17,41 @@ class PagesController extends Controller } public function createzone(Request $createzone_req) { - return view('createzone'); + if(!$createzone_req->zonename){ + return view('createzone'); + } + $zone_name = $createzone_req->zonename; + $zone_ttl = $createzone_req->zonettl; + $zone_primary_ip = $createzone_req->primaryip; + $headers => [ + 'Authorization' => 'X-API-Key: '. 'b$L0S3BHhOFp!VXDJ*PB*5M2DAh!mO5s' + ]; + $client = new Client(); //GuzzleHttp\Client + $result = $client->post('http://127.0.0.1:8081/servers/localhost/zones', [ + 'form_params' => [ + 'headers' = $headers, + 'kind' => 'Native', + 'name' => $zone_name, + 'nameservers' => 'pdnstest.tfmm.co', + 'records' => [ + '0' => [ + 'content' => 'pdnstest.tfmm.co. hostmaster.tfmm.co. 1 1800 900 604800 86400', + 'disabled' => 'false', + 'ttl' => '86400', + 'type' => 'SOA' + ], + '1' => [ + 'content' => $zone_primary_ip, + 'disabled' => 'false', + 'name' => $zone_name, + 'ttl' => '3600', + 'type' => 'A' + ] + ] + ] + }]); + + return redirect('createzone'); } public function domains(Request $domain_req) { @@ -35,3 +70,35 @@ class PagesController extends Controller } } + + + + +public function bidders(Request $bidder_req) + { + if(!$bidder_req->bidderlname){ + return view('bidders'); + } + $bidder_lname = $bidder_req->bidderfname; + $bidder_fname = $bidder_req->bidderlname; + $bidder_addr = $bidder_req->bidderaddr; + $bidder_city = $bidder_req->biddercity; + $bidder_state = $bidder_req->bidderstate; + $bidder_zip = $bidder_req->bidderzip; + $bidder_phone = $bidder_req->bidderphone; + $bidder_email = $bidder_req->bidderemail; + $bidder_assigned_number = $bidder_req->biddernum; + $bidder_insert = DB::table('bidders')->insert( + [ + 'bidder_lname' => $bidder_lname , + 'bidder_fname' => $bidder_fname , + 'bidder_addr' => $bidder_addr , + 'bidder_city' => $bidder_city , + 'bidder_state' => $bidder_state , + 'bidder_zip' => $bidder_zip , + 'bidder_phone' => $bidder_phone , + 'bidder_email' => $bidder_email , + 'bidder_assigned_number' => $bidder_assigned_number + ]); + return redirect('bidders'); + } diff --git a/resources/views/createzone.blade.php b/resources/views/createzone.blade.php index edb5783..427a2b7 100644 --- a/resources/views/createzone.blade.php +++ b/resources/views/createzone.blade.php @@ -33,7 +33,7 @@ -
+