Advertisement
a6a51

Payment confirmation command

Mar 20th, 2018
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Console\Commands;
  4.  
  5. use Illuminate\Console\Command;
  6. use App\Jobs\CheckPayment;
  7. use App\PaymentConfirmation;
  8.  
  9. class CheckPaymentConfirmation extends Command
  10. {
  11.     /**
  12.      * The name and signature of the console command.
  13.      *
  14.      * @var string
  15.      */
  16.     protected $signature = 'payment:confirmation';
  17.  
  18.     /**
  19.      * The console command description.
  20.      *
  21.      * @var string
  22.      */
  23.     protected $description = 'Check if the user is paying or not on 2 hours after booking.';
  24.  
  25.     /**
  26.      * Create a new command instance.
  27.      *
  28.      * @return void
  29.      */
  30.     public function __construct()
  31.     {
  32.         parent::__construct();
  33.     }
  34.  
  35.     /**
  36.      * Execute the console command.
  37.      *
  38.      * @return mixed
  39.      */
  40.     public function handle()
  41.     {
  42.         $payments = PaymentConfirmation::where('status', PaymentConfirmation::UNCONFIRMED)->get();
  43.         foreach ($payments as $payment) {
  44.             dispatch(new CheckPayment($payment));
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement