Skip to content

Instantly share code, notes, and snippets.

@itoonx
Created March 2, 2018 23:04
Show Gist options
  • Save itoonx/5716a9acac354b1dd0a6541eae3eb647 to your computer and use it in GitHub Desktop.
Save itoonx/5716a9acac354b1dd0a6541eae3eb647 to your computer and use it in GitHub Desktop.
Example for handle job to every 5 minute
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Carbon\Carbon;
use App\Jobs\Syncing;
use Log;
class Syncing implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$balance_a = app('App\Http\Controllers\WalletController')->CheckConfirm("BTC");
$balance_b = app('App\Http\Controllers\WalletController')->sync("BTC");
$balance_c = app('App\Http\Controllers\WalletController')->CheckConfirm("BCH");
$balance_d = app('App\Http\Controllers\WalletController')->sync("BCH");
Syncing::dispatch()->delay(Carbon::now()->addSeconds(5));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment