PHP code example of jalameta / jps-support

1. Go to this page and download the library: Download jalameta/jps-support library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jalameta / jps-support example snippets


use Jalameta\Support\Bus\BaseJob;

class MakePayment extends BaseJob
{
    /** 
    * @var Payment
    */
    public $payment;
    
    /**
     * Run the actual command process.
     *
     * @return mixed
     */
    public function run()
    {
        // Callbacks are running when the job 
        // running successfully, based on the return value of run() method
        $this->onSuccess(function () {
            dispatch_now(new GenerateInvoice($this->payment))
        });
    
        $this->payment = new Payment();
        $this->payment->total = $this->request->input('total');
        $this->payment->method = $this->request->input('method');
        $this->payment->user()->associate(auth()->user());
        
        return $this->payment->save();
    }
}