App\Ninja\Intents\BaseIntent::__construct PHP Method

__construct() public method

public __construct ( $state, $data )
    public function __construct($state, $data)
    {
        //if (true) {
        if (!$state || is_string($state)) {
            $state = new stdClass();
            foreach (['current', 'previous'] as $reference) {
                $state->{$reference} = new stdClass();
                $state->{$reference}->entityType = false;
                foreach ([ENTITY_INVOICE, ENTITY_CLIENT, ENTITY_INVOICE_ITEM] as $entityType) {
                    $state->{$reference}->{$entityType} = [];
                }
            }
        }
        $this->state = $state;
        $this->data = $data;
        //var_dump($state);
    }

Usage Example

 public function __construct($state, $data)
 {
     $this->invoiceRepo = app('App\\Ninja\\Repositories\\InvoiceRepository');
     parent::__construct($state, $data);
 }