update kurs
This commit is contained in:
parent
473b9251d8
commit
8b6c5b7886
@ -56,22 +56,34 @@
|
|||||||
|
|
||||||
public function ont()
|
public function ont()
|
||||||
{
|
{
|
||||||
$json = File::get('storage/kurs.json');
|
if (File::exists('storage/kurs.json')) {
|
||||||
$kurs = json_decode($json);
|
$json = File::get('storage/kurs.json');
|
||||||
if($kurs->date != date('Y-m-d')){
|
$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();
|
$this->getKurs();
|
||||||
}
|
}
|
||||||
|
|
||||||
$json = File::get('storage/kurs.json');
|
$json = File::get('storage/kurs.json');
|
||||||
$kurs = json_decode($json);
|
$kurs = json_decode($json);
|
||||||
$usd = $kurs->rates->IDR/$kurs->rates->USD;
|
$usd = $kurs->conversion_rate;
|
||||||
$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();
|
$date = Carbon::createFromTimestamp($kurs->time_last_update_unix)
|
||||||
$header = $sheets->pull(0);
|
->locale('id')
|
||||||
$posts = Sheets::collection($header, $sheets);
|
->setTimezone('Asia/Jakarta')
|
||||||
$posts = $posts->take(5000);
|
->translatedFormat('d F Y H:i:s');
|
||||||
$data = new Collection($posts->toArray());
|
|
||||||
|
$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);
|
$platform = $data->random(5);
|
||||||
|
|
||||||
return view('frontend::ont', compact('kurs', 'usd','date','platform'));
|
return view('frontend::ont', compact('kurs', 'usd','date','platform'));
|
||||||
|
Loading…
Reference in New Issue
Block a user