Merge branch 'master' of https://git.putrakuningan.com/putrakuningan/Frontend
# Conflicts: # Http/Controllers/FrontendController.php
This commit is contained in:
commit
540869408d
@ -1,205 +1,208 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Http\Controllers;
|
||||
namespace Modules\Frontend\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Revolution\Google\Sheets\Facades\Sheets;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Revolution\Google\Sheets\Facades\Sheets;
|
||||
|
||||
class FrontendController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
class FrontendController extends Controller
|
||||
{
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
if($kurs->date != date('Y-m-d')){
|
||||
$this->getKurs();
|
||||
}
|
||||
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
$usd = $kurs->rates->IDR/$kurs->rates->USD;
|
||||
$date = Carbon::createFromTimestamp($kurs->timestamp)->locale('id')->setTimezone('Asia/Jakarta')->translatedFormat('d F Y H:i:s');
|
||||
|
||||
$sheets = Sheets::spreadsheet('1c2Uv3QVTyLzsJPE4uqqlMGNKO8z0Kqj6aEGh0uixAqA')->sheet('Platform')->range('A:F')->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$posts = $posts->take(5000);
|
||||
$data = new Collection($posts->toArray());
|
||||
$platform = $data->random(5);
|
||||
|
||||
return view('frontend::index', compact('kurs', 'usd','date','platform'));
|
||||
}
|
||||
|
||||
public function ont()
|
||||
{
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
if($kurs->date != date('Y-m-d')){
|
||||
$this->getKurs();
|
||||
}
|
||||
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
$usd = $kurs->rates->IDR/$kurs->rates->USD;
|
||||
$date = Carbon::createFromTimestamp($kurs->timestamp)->locale('id')->setTimezone('Asia/Jakarta')->translatedFormat('d F Y H:i:s');
|
||||
|
||||
$sheets = Sheets::spreadsheet('1c2Uv3QVTyLzsJPE4uqqlMGNKO8z0Kqj6aEGh0uixAqA')->sheet('Platform')->range('A:F')->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$posts = $posts->take(5000);
|
||||
$data = new Collection($posts->toArray());
|
||||
$platform = $data->random(5);
|
||||
|
||||
return view('frontend::ont', compact('kurs', 'usd','date','platform'));
|
||||
}
|
||||
|
||||
public function press()
|
||||
{
|
||||
return view('frontend::press-release');
|
||||
}
|
||||
|
||||
public function cakupan()
|
||||
{
|
||||
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
if($kurs->date != date('Y-m-d')){
|
||||
$this->getKurs();
|
||||
}
|
||||
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
$usd = $kurs->rates->IDR/$kurs->rates->USD;
|
||||
$date = Carbon::createFromTimestamp($kurs->timestamp)->locale('id')->setTimezone('Asia/Jakarta')->translatedFormat('d F Y H:i:s');
|
||||
|
||||
$sheets = Sheets::spreadsheet('1c2Uv3QVTyLzsJPE4uqqlMGNKO8z0Kqj6aEGh0uixAqA')->sheet('Platform')->range('A:F')->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$data = new Collection($posts->toArray());
|
||||
|
||||
return view('frontend::cakupan', compact('kurs', 'usd','date','data'));
|
||||
}
|
||||
|
||||
public function peneliti()
|
||||
{
|
||||
$sheets = Sheets::spreadsheet('1kM32QnxjRDpH1WkFSfOwMuTKzoCQpXFDYhekARcypjY')->sheet('Research Proposal')->range('A:K')->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$posts = $posts->take(5000);
|
||||
|
||||
$data = $posts->toArray();
|
||||
|
||||
$researcher = [];
|
||||
$no = 1;
|
||||
if ($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
if ($data[$key]['Researchers Name'] != null) {
|
||||
$output['no'] = $no++;
|
||||
$output['id'] = $data[$key]['ID'];
|
||||
$output['reseracher_name'] = $data[$key]['Researchers Name'];
|
||||
$output['region'] = $data[$key]['Region'];
|
||||
$output['institution'] = $data[$key]['Institution'];
|
||||
$output['research_title'] = $data[$key]['Research Title'];
|
||||
$output['email'] = $data[$key]['Email'];
|
||||
$output['registration_date'] = $data[$key]['Registration Date'];
|
||||
|
||||
$researcher[] = $output;
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
if (File::exists('storage/kurs.json')) {
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
$date = Carbon::createFromTimestamp($kurs->time_last_update_unix)->format('Y-m-d');
|
||||
if ($date != date('Y-m-d')) {
|
||||
$this->getKurs();
|
||||
}
|
||||
} else {
|
||||
$this->getKurs();
|
||||
}
|
||||
} else {
|
||||
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
$usd = $kurs->conversion_rate;
|
||||
|
||||
$date = Carbon::createFromTimestamp($kurs->time_last_update_unix)
|
||||
->locale('id')
|
||||
->setTimezone('Asia/Jakarta')
|
||||
->translatedFormat('d F Y H:i:s');
|
||||
|
||||
$sheets = Sheets::spreadsheet('1c2Uv3QVTyLzsJPE4uqqlMGNKO8z0Kqj6aEGh0uixAqA')
|
||||
->sheet('Platform')
|
||||
->range('A:F')
|
||||
->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$posts = $posts->take(5000);
|
||||
$data = new Collection($posts->toArray());
|
||||
$platform = $data->random(5);
|
||||
|
||||
return view('frontend::index', compact('kurs', 'usd', 'date', 'platform'));
|
||||
}
|
||||
|
||||
public function cakupan()
|
||||
{
|
||||
|
||||
if (File::exists('storage/kurs.json')) {
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
$date = Carbon::createFromTimestamp($kurs->time_last_update_unix)->format('Y-m-d');
|
||||
if ($date != date('Y-m-d')) {
|
||||
$this->getKurs();
|
||||
}
|
||||
} else {
|
||||
$this->getKurs();
|
||||
}
|
||||
|
||||
$json = File::get('storage/kurs.json');
|
||||
$kurs = json_decode($json);
|
||||
$usd = $kurs->conversion_rate;
|
||||
$date = Carbon::createFromTimestamp($kurs->time_last_update_unix)
|
||||
->locale('id')
|
||||
->setTimezone('Asia/Jakarta')
|
||||
->translatedFormat('d F Y H:i:s');
|
||||
|
||||
$sheets = Sheets::spreadsheet('1c2Uv3QVTyLzsJPE4uqqlMGNKO8z0Kqj6aEGh0uixAqA')
|
||||
->sheet('Platform')
|
||||
->range('A:F')
|
||||
->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$data = new Collection($posts->toArray());
|
||||
|
||||
return view('frontend::cakupan', compact('kurs', 'usd', 'date', 'data'));
|
||||
}
|
||||
|
||||
public function peneliti()
|
||||
{
|
||||
$sheets = Sheets::spreadsheet('1kM32QnxjRDpH1WkFSfOwMuTKzoCQpXFDYhekARcypjY')
|
||||
->sheet('Research Proposal')
|
||||
->range('A:K')
|
||||
->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$posts = $posts->take(5000);
|
||||
|
||||
$data = $posts->toArray();
|
||||
|
||||
$researcher = [];
|
||||
}
|
||||
$no = 1;
|
||||
if ($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
if ($data[$key]['Researchers Name'] != null) {
|
||||
$output['no'] = $no++;
|
||||
$output['id'] = $data[$key]['ID'];
|
||||
$output['reseracher_name'] = $data[$key]['Researchers Name'];
|
||||
$output['region'] = $data[$key]['Region'];
|
||||
$output['institution'] = $data[$key]['Institution'];
|
||||
$output['research_title'] = $data[$key]['Research Title'];
|
||||
$output['email'] = $data[$key]['Email'];
|
||||
$output['registration_date'] = $data[$key]['Registration Date'];
|
||||
|
||||
return view('frontend::peneliti', compact('researcher'));
|
||||
}
|
||||
|
||||
public function facility()
|
||||
{
|
||||
$sheets = Sheets::spreadsheet('1kM32QnxjRDpH1WkFSfOwMuTKzoCQpXFDYhekARcypjY')->sheet('Sequencing Facility')->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$posts = $posts->take(5000);
|
||||
|
||||
$data = $posts->toArray();
|
||||
|
||||
$facility = [];
|
||||
$no = 1;
|
||||
if ($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
if ($data[$key]['Facility Name'] != null) {
|
||||
$output['no'] = $no++;
|
||||
$output['facility_name'] = $data[$key]['Facility Name'];
|
||||
$output['institution'] = $data[$key]['Institution'];
|
||||
$output['address'] = $data[$key]['Address'];
|
||||
$output['region'] = $data[$key]['Region'];
|
||||
|
||||
$facility[] = $output;
|
||||
$researcher[] = $output;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$researcher = [];
|
||||
}
|
||||
} else {
|
||||
|
||||
return view('frontend::peneliti', compact('researcher'));
|
||||
}
|
||||
|
||||
public function facility()
|
||||
{
|
||||
$sheets = Sheets::spreadsheet('1kM32QnxjRDpH1WkFSfOwMuTKzoCQpXFDYhekARcypjY')
|
||||
->sheet('Sequencing Facility')
|
||||
->get();
|
||||
$header = $sheets->pull(0);
|
||||
$posts = Sheets::collection($header, $sheets);
|
||||
$posts = $posts->take(5000);
|
||||
|
||||
$data = $posts->toArray();
|
||||
|
||||
$facility = [];
|
||||
$no = 1;
|
||||
if ($data) {
|
||||
foreach ($data as $key => $value) {
|
||||
if ($data[$key]['Facility Name'] != null) {
|
||||
$output['no'] = $no++;
|
||||
$output['facility_name'] = $data[$key]['Facility Name'];
|
||||
$output['institution'] = $data[$key]['Institution'];
|
||||
$output['address'] = $data[$key]['Address'];
|
||||
$output['region'] = $data[$key]['Region'];
|
||||
|
||||
$facility[] = $output;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$facility = [];
|
||||
}
|
||||
|
||||
return view('frontend::facility', compact('facility'));
|
||||
}
|
||||
|
||||
return view('frontend::facility', compact('facility'));
|
||||
}
|
||||
public function hibah()
|
||||
{
|
||||
return view('frontend::hibah');
|
||||
}
|
||||
|
||||
public function hibah()
|
||||
{
|
||||
return view('frontend::hibah');
|
||||
}
|
||||
public function kuisioner()
|
||||
{
|
||||
return view('frontend::kuisioner');
|
||||
}
|
||||
|
||||
public function kuisioner()
|
||||
{
|
||||
return view('frontend::kuisioner');
|
||||
}
|
||||
public function consent()
|
||||
{
|
||||
return view('frontend::consent');
|
||||
}
|
||||
|
||||
public function consent()
|
||||
{
|
||||
return view('frontend::consent');
|
||||
}
|
||||
public function silx_ci()
|
||||
{
|
||||
return view('frontend::ci');
|
||||
}
|
||||
|
||||
public function silx_ci()
|
||||
{
|
||||
return view('frontend::ci');
|
||||
}
|
||||
public function silx_ic()
|
||||
{
|
||||
return view('frontend::ic');
|
||||
}
|
||||
public function silx_ic()
|
||||
{
|
||||
return view('frontend::ic');
|
||||
}
|
||||
|
||||
public function getKurs(){
|
||||
$response = Http::get('http://api.exchangeratesapi.io/v1/latest?access_key=9f7cd7db5b72280a93c8e15243fadab7&symbols=USD,IDR');
|
||||
$data = $response->json();
|
||||
Storage::disk('public')->put('kurs.json', json_encode($data));
|
||||
}
|
||||
public function getKurs()
|
||||
{
|
||||
$response = Http::get('https://v6.exchangerate-api.com/v6/7ac9163481b1e658bc0ef6a5/pair/USD/IDR');
|
||||
$data = $response->json();
|
||||
Storage::disk('public')->put('kurs.json', json_encode($data));
|
||||
}
|
||||
|
||||
public function domain(Request $request)
|
||||
{
|
||||
public function domain(Request $request)
|
||||
{
|
||||
|
||||
if (isset($request->search)) {
|
||||
$domain = $request->search;
|
||||
$response = Http::asForm()->POST('https://srb1975.srs-x.com/api/domain/check', [
|
||||
'username' => "qnwa882l",
|
||||
'password' => "cdae44fd320c033dcd69718b217cdcc6fd51b8476d739e3d8b1c3a1fa5366395",
|
||||
'domain' => $domain,
|
||||
]);
|
||||
if (isset($request->search)) {
|
||||
$domain = $request->search;
|
||||
$response = Http::asForm()->POST('https://srb1975.srs-x.com/api/domain/check', [
|
||||
'username' => "qnwa882l",
|
||||
'password' => "cdae44fd320c033dcd69718b217cdcc6fd51b8476d739e3d8b1c3a1fa5366395",
|
||||
'domain' => $domain,
|
||||
]);
|
||||
|
||||
$data = simplexml_load_string($response->body());
|
||||
$data = $data->result;
|
||||
return view('frontend::domain', compact('data'));
|
||||
} else {
|
||||
return view('frontend::domain');
|
||||
$data = simplexml_load_string($response->body());
|
||||
$data = $data->result;
|
||||
return view('frontend::domain', compact('data'));
|
||||
} else {
|
||||
return view('frontend::domain');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user