Skip to content

Commit

Permalink
Merge pull request #1 from ECLK/master
Browse files Browse the repository at this point in the history
pull
  • Loading branch information
ShanukaGIT authored Mar 16, 2020
2 parents 0357d5c + a046dff commit f387288
Show file tree
Hide file tree
Showing 10 changed files with 854 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ APP_KEY=base64:sBNbJThk+cKYWyRAisG8KYkFAkv527csvLTIMlRcP8I=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
NOMINETION_API=https://jsonplaceholder.typicode.com/users
NOMINETION_API=https://apim-gateway.ecdev.opensource.lk/nominations/0.9/
NOMINETION_API_KEY=45c03f99-c08c-39cb-a46b-ce3d322f0479

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
Expand Down
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/vendor/
node_modules/
npm-debug.log
yarn-error.log

# Laravel 4 specific
bootstrap/compiled.php
app/storage/

# Laravel 5 & Lumen specific
public/storage
public/hot

# Laravel 5 & Lumen specific with changed public path
public_html/storage
public_html/hot

storage/*.key
.env
Homestead.yaml
Homestead.json
/.vagrant
.phpunit.result.cache
storage/framework/views/ae5a9a730500788d3a7068e5205c4fdaa854b85b.php
storage/logs/laravel.log
storage/logs/laravel.log
17 changes: 6 additions & 11 deletions app/Http/Controllers/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,37 @@
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use GuzzleHttp\Client;

class FormController extends Controller
{
public function viewPE9()
{
$client = new Client();
$response = $client->request('GET', env('NOMINETION_API'));
$statusCode = $response->getStatusCode();
// $body = $response->getBody();
$client = resolve('nomination.client');
$response = $client->request('GET', 'teams');
$statusCode = $response->getStatusCode();
$body = $response->getBody()->getContents();
$obj = json_decode($body);
//dd($body);
return view('pe9')->with('Fdata',$obj);

}

public function viewPE30()
{
$client = new Client();
$response = $client->request('GET', env('NOMINETION_API'));
$client = resolve('nomination.client');
$response = $client->request('GET','elections/electionStatus/APPROVE');
$statusCode = $response->getStatusCode();
$body = $response->getBody()->getContents();
$obj = json_decode($body);
return view('pe30x1x2')->with('Fdata',$obj);

}

public function getDistrict(Request $request){
$client = new Client();
$response = $client->request('GET', env('NOMINETION_API').'?id='.$request->id);
$statusCode = $response->getStatusCode();
$body = $response->getBody()->getContents();
$data = json_decode($body);
return response()->json($data);


}

public function getBallot(Request $request){
Expand Down
23 changes: 23 additions & 0 deletions app/Providers/NominationClientServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace App\Providers;

use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use GuzzleHttp\Client;

class NominationClientServiceProvider extends ServiceProvider
{

public function register()
{
$this->app->bind('nomination.client', function () {
$config = [
'base_uri' => env('NOMINETION_API'),
'headers' => [
'Authorization' => 'Bearer ' . env('NOMINETION_API_KEY')
]
];
return new Client($config);
});
}
}
2 changes: 2 additions & 0 deletions bootstrap/cache/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
24 => 'App\\Providers\\AuthServiceProvider',
25 => 'App\\Providers\\EventServiceProvider',
26 => 'App\\Providers\\RouteServiceProvider',
27 => 'App\\Providers\\NominationClientServiceProvider',
),
'eager' =>
array (
Expand All @@ -45,6 +46,7 @@
11 => 'App\\Providers\\AuthServiceProvider',
12 => 'App\\Providers\\EventServiceProvider',
13 => 'App\\Providers\\RouteServiceProvider',
14 => 'App\\Providers\\NominationClientServiceProvider',
),
'deferred' =>
array (
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,

App\Providers\NominationClientServiceProvider::class,
],

/*
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<link href="https://fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lora:400,400i,700,700i" rel="stylesheet">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<!-- Custom styles for this template -->
<link href="css/business-casual.min.css" rel="stylesheet">

Expand Down Expand Up @@ -102,6 +104,9 @@
</div>
</footer>

<?php echo $__env->yieldPushContent('scripts'); ?>


<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
Expand Down
Loading

0 comments on commit f387288

Please sign in to comment.