⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.10
Server IP:
157.245.101.34
Server:
Linux skvinfotech-website 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
Server Software:
Apache/2.4.41 (Ubuntu)
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
html
/
app
/
Console
/
Commands
/
View File Name :
GoogleToken.php
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use App\Helpers\GoogleTokenGenerate; use Illuminate\Support\Facades\DB; use Log; class GoogleToken extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'google:token'; /** * The console command description. * * @var string */ protected $description = 'For api to get address from google map generate token'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return int */ public function handle() { $token = DB::table('map_tokens')->first(); $today = date('Y-m-d H:i:s'); if($token){ $starttime = date('Y-m-d H:i:s', strtotime($token->updated_at)); $endtime = date('Y-m-d H:i:s',strtotime("+1440 minutes",strtotime($starttime))); if($today >= $endtime){ $gen_token = GoogleTokenGenerate::generate(); $token = DB::table('map_tokens') ->where('id', 1) ->update(['token' => $gen_token, 'updated_at' => \Carbon\Carbon::now(), ]); } }else{ $gen_token = GoogleTokenGenerate::generate(); $token = DB::table('map_tokens')->insert([ 'token' => $gen_token, 'created_at' => \Carbon\Carbon::now(), # new \Datetime() 'updated_at' => \Carbon\Carbon::now(), # new \Datetime() ]); } Log::info('cron check'); } }