Skip to content

Commit

Permalink
Merge pull request #29 from ryanaidilp/5.0.0
Browse files Browse the repository at this point in the history
Update to version 5.0.0
  • Loading branch information
ryanaidilp authored Jul 28, 2021
2 parents 712e371 + deedda1 commit 165fac0
Show file tree
Hide file tree
Showing 471 changed files with 96,814 additions and 23,031 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["@babel/plugin-syntax-dynamic-import"]
}
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
quote_type= double

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
10 changes: 7 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,26 @@ LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=boiler_plate
DB_DATABASE=pico_sulteng_web
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
Expand All @@ -37,6 +40,7 @@ AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
/vendor
.env
.env.backup
.env.prod
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.idea
/.vscode
_ide_helper.php
84 changes: 49 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,62 @@
<h1 align="center"> PICO SulTeng WEB </h1>
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>

![PICO SulTeng WEB](https://i.ibb.co/8b5cFjL/newpico.jpg)
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>

[PICO SulTeng WEB](https://banuacoders.com/corona) is the web version of PICO SulTeng (*Pusat Informasi COVID-19 Sulawesi Tengah*/COVID-19 Information Center of Central Sulawesi). It is built using [Laravel](https://laravel.com/), [Vue.js](https://vuejs.org), [Tailwind CSS](https://tailwindcss.com), & [Inertia Js](https://inertiajs.com). This website is built to facilitate the people of Central Sulawesi in obtaining information about the current situation of COVID-19 in Central Sulawesi.
## About Laravel

## Configuration
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

This website is designed to be deployed to a sub-folder on shared hosting.
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).

To run this website on your local machine, follow these instruction carefully :
Laravel is accessible, powerful, and provides tools required for large, robust applications.

* **Deploy instruction**
* Clone this repository to your PC/laptop.
* Open terminal/CMD then go to the **root directory** of the clone results.
* Run this command `cp .env.example .env`
* Run `composer install` / `composer update` & `npm install` command to install all required dependencies.
* Run `php artisan migrate` to create fresh database and tables with empty data
## Learning Laravel

* **Deploy using artisan command**
* Just run `php artisan serve` from your terminal
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

* **Deploy on XAMPP**
* Create a new directory in **htdocs**
* Copy all files and directories in the public folder to the root folder in the directory you just created
* Create a new directory in the directory that you just created then copy all the cloned files except the public folder to that directory
* Modify your index.php
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

```php
require __DIR__.'/../<new-dir-you-just-created>/vendor/autoload.php';
## Laravel Sponsors

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/../<new-dir-you-just-created>/bootstrap/app.php';
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).

```
### Premium Partners

## Disclaimer
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**

Support me by following this account or starring this repository
## Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
36 changes: 15 additions & 21 deletions app/Console/Commands/UpdateData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace App\Console\Commands;

use Carbon\Carbon;
use App\Models\NationalCase;
use Illuminate\Console\Command;
use App\Models\NationalCaseHistory;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;

Expand All @@ -15,14 +15,14 @@ class UpdateData extends Command
*
* @var string
*/
protected $signature = 'covid:update';
protected $signature = "covid:update";

/**
* The console command description.
*
* @var string
*/
protected $description = 'Update covid data';
protected $description = "Update covid data";

/**
* Create a new command instance.
Expand All @@ -41,38 +41,32 @@ public function __construct()
*/
public function handle()
{
$response = Http::get('https://data.covid19.go.id/public/api/update.json');
$response = Http::get("https://data.covid19.go.id/public/api/update.json");
if ($response->status() == 200) {
$response = json_decode($response->body());
$response = $response->update;
$newCase = $response->penambahan;
$cumulative = $response->total;
$latest = NationalCaseHistory::latest()->first();
$latest = NationalCase::latest()->first();
$date = Carbon::parse($newCase->created);
$data = NationalCaseHistory::whereDate('date', $date)->get()->first();
$data = NationalCase::whereDate("date", $date)->get()->first();
if ($data) {
$this->error('Data already exists!');
$this->error("Data already exists!");
return;
}
if (!$date->isToday()) {
Log::notice("Data tidak diperbarui!");
return;
}
NationalCaseHistory::create([
'day' => $latest->day + 1,
'date' => $date,
'cumulative_positive' => $cumulative->jumlah_positif,
'cumulative_under_treatment' => $cumulative->jumlah_dirawat,
'cumulative_recovered' => $cumulative->jumlah_sembuh,
'cumulative_deceased' => $cumulative->jumlah_meninggal,
'daily_positive_case' => $newCase->jumlah_positif,
'daily_under_treatment_case' => $newCase->jumlah_dirawat,
'daily_recovered_case' => $newCase->jumlah_sembuh,
'daily_deceased_case' => $newCase->jumlah_meninggal,
NationalCase::create([
"day" => $latest->day + 1,
"date" => $date,
"positive" => $newCase->jumlah_positif,
"recovered" => $newCase->jumlah_sembuh,
"deceased" => $newCase->jumlah_meninggal,
]);
$this->info('Successfully updated data');
$this->info("Successfully updated data");
} else {
$this->error('Failed create connection to the server');
$this->error("Failed create connection to the server");
}
return 0;
}
Expand Down
50 changes: 33 additions & 17 deletions app/Console/Commands/UpdateProvince.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
namespace App\Console\Commands;

use App\Models\Province;
use Illuminate\Support\Str;
use App\Models\NationalCase;
use App\Models\ProvinceCase;
use Illuminate\Support\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;

class UpdateProvince extends Command
Expand Down Expand Up @@ -39,24 +44,35 @@ public function __construct()
*/
public function handle()
{
$response = Http::get('https://api.kawalcorona.com/indonesia/provinsi');
if ($response->successful()) {
$arrayProvince = $response->json();
foreach ($arrayProvince as $prov) {
$province = $prov['attributes'];
$positif = $province['Kasus_Posi'];
$sembuh = $province['Kasus_Semb'];
$meninggal = $province['Kasus_Meni'];
Province::where('kode_provinsi', $province['Kode_Provi'])
->update([
'positif' => $positif,
'sembuh' => $sembuh,
'meninggal' => $meninggal,
]);
$provinces = Province::all();
$national_case = NationalCase::latest()->first();
$provinces = Province::all();

foreach ($provinces as $province) {
$province_name = Str::replace(" ", "_", Str::upper($province->name));
$data = Http::get("https://data.covid19.go.id/public/api/prov_detail_{$province_name}.json");
$first_case_province = $data["list_perkembangan"][0]["tanggal"];
$first_case_province = (int) substr(Str::of($first_case_province), 0, -3);
$first_case_province = Carbon::parse($first_case_province);

$data = collect($data["list_perkembangan"]);
$data = $data->filter(function ($daily) {
$dateint = (int) substr(Str::of($daily["tanggal"]), 0, -3);
$date = Carbon::parse($dateint);
return $date->isToday();
})->values()->first();

if ($data) {
ProvinceCase::create([
"day" => $national_case->day,
"province_id" => $province->id,
"positive" => $data["KASUS"],
"recovered" => $data["SEMBUH"],
"deceased" => $data["MENINGGAL"],
]);
} else {
Log::error("Gagal memperbarui data covid $province_name");
}
$this->info('Successfully updated all province data!');
} else {
$this->error('Failed to update province!');
}
return 0;
}
Expand Down
73 changes: 73 additions & 0 deletions app/Console/Commands/UpdateVaccine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php

namespace App\Console\Commands;

use Carbon\Carbon;
use App\Models\NationalVaccine;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Http;

class UpdateVaccine extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = "vaccine:update";

/**
* The console command description.
*
* @var string
*/
protected $description = "Update national vaccine data";

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$vaccine = NationalVaccine::latest()->first();
$data = Http::get("https://data.covid19.go.id/public/api/pemeriksaan-vaksinasi.json");
$data = $data["vaksinasi"]["penambahan"];
$date = Carbon::parse($data["tanggal"]);
if ($date->isAfter($vaccine->date)) {
NationalVaccine::create([
"day" => $vaccine->day + 1,
"date" => Carbon::parse($data["created"]),
"total_vaccination_target" => $vaccine->total_vaccination_target,
"first_vaccination_received" => $data["jumlah_vaksinasi_1"],
"second_vaccination_received" => $data["jumlah_vaksinasi_2"],
"health_worker_vaccination_target" => $vaccine->health_worker_vaccination_target,
"health_worker_first_vaccination_received" => $vaccine->health_worker_first_vaccination_received,
"health_worker_second_vaccination_received" => $vaccine->health_worker_second_vaccination_received,
"elderly_vaccination_target" => $vaccine->elderly_vaccination_target,
"elderly_first_vaccination_received" => $vaccine->elderly_first_vaccination_received,
"elderly_second_vaccination_received" => $vaccine->elderly_second_vaccination_received,
"public_officer_vaccination_target" => $vaccine->public_officer_vaccination_target,
"public_officer_first_vaccination_received" => $vaccine->public_officer_first_vaccination_received,
"public_officer_second_vaccination_received" => $vaccine->public_officer_second_vaccination_received,

]);
$this->info("Berhasil memperbarui data vaksin");
} else {
Log::error("Gagal memperbarui data vaksin!");
$this->error("Gagal memperbarui data vaksin!");
}
return 0;
}
}
Loading

0 comments on commit 165fac0

Please sign in to comment.