PHP code example of mangopixel / laravel-adjuster

1. Go to this page and download the library: Download mangopixel/laravel-adjuster 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/ */

    

mangopixel / laravel-adjuster example snippets


Mangopixel\Adjuster\AdjusterServiceProvider::class



namespace App;

use Mangopixel\Adjuster\Adjustable;
use Mangopixel\Adjuster\CanBeAdjusted;

class Fruit extends Model implements Adjustable
{
  use CanBeAdjusted;
}

$fruit->adjust( [
    'name' => 'Mango',
    'price' => 100
] );

$fruit->adjust( [
    'name' => 'Mango',
    'price' => 100
], [
    'message' => 'This adjustment was fruitful'
] );

$fruit->adjust( [
    'name' => null
] );

$fruit->applyAdjustments();

$fruit->isAdjusted();

protected $saveProtection = false;

$fruit->hasSaveProtection();

$model->adjustment;

$adjustment->adjustable;



namespace App;

class Adjustment extends Model
{
    public $timestamps = false;
}

protected $casts = [ 'changes' => 'array' ]
shell
php artisan vendor:publish --provider="Mangopixel\Adjuster\AdjusterServiceProvider"