PHP code example of jn-devops / contracts

1. Go to this page and download the library: Download jn-devops/contracts 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/ */

    

jn-devops / contracts example snippets


return [
    'notifications' => [
        OnboardedToPaid::class => [
            PostPaymentBuyerNotification::class
        ],
    ]
];

use Homeful\Properties\Models\Property as Inventory;
use Homeful\Contacts\Models\Contact as Customer;
use Homeful\Contracts\States\Consulted;
use Homeful\Contacts\Data\ContactData;
use Homeful\Contracts\Models\Contract;
use Homeful\Common\Classes\Input;
use Homeful\Mortgage\Mortgage;

$contract = new Contract;
$contract->customer = $customer;
$contract->inventory = $inventory;
$contract->percent_down_payment = $params[Input::PERCENT_DP];
$contract->percent_miscellaneous_fees = $params[Input::PERCENT_MF];
$contract->down_payment_term = $params[Input::DP_TERM];
$contract->balance_payment_term = $params[Input::BP_TERM];
$contract->interest_rate = $params[Input::BP_INTEREST_RATE];
$contract->save();
$contract->load('customer', 'inventory');

$contract->state->transitionTo(Consulted::class, reference: $reference);
$contract->mortgage instanceof \Homeful\Mortgage\Mortgage
$data = ContactData::fromModel($contract);
bash
php artisan vendor:publish --tag="contracts-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="contracts-config"
bash
php artisan vendor:publish --tag="contracts-views"