This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// app/Console/Commands/Generate/GenerateModels.php | |
namespace App\Console\Commands\Generate; | |
use Illuminate\Console\Command; | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Support\Str; | |
use Illuminate\Support\Facades\DB; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//path to local json file. | |
$json_uri = "C:\Dev\covid-19\covid-19-states-daily-cases.json"; | |
//path to KKM csv | |
$fetch_uri = "https://raw.githubusercontent.com/MoH-Malaysia/covid19-public/main/epidemic/cases_state.csv"; | |
//open csv | |
$file = fopen($fetch_uri,'r'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo '<pre>'; | |
$arr1 = ['1','2','3','4']; | |
$arr2 = ['1','2','3','3','4','4','5','5','6','6','7','8','9']; | |
//done 1 | |
$arr1Low = arsort($arr1); | |
print_r($arr1Low); | |
echo '<br />'; | |
//done 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
Thanks stackoverflow | |
*/ | |
function getOS($user_agent) { | |
$os_array = array( | |
'/windows nt 10/i' => 'Windows 10', | |
'/windows nt 6.3/i' => 'Windows 8.1', | |
'/windows nt 6.2/i' => 'Windows 8', | |
'/windows nt 6.1/i' => 'Windows 7', |