PHP code example of nevadskiy / laravel-money

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

    

nevadskiy / laravel-money example snippets


use Nevadskiy\Money\Casts\AsMoney;

/**
 * The attributes that should be cast.
 *
 * @var array
 */
protected $casts = [
    'cost' => AsMoney::class.':UAH',
];

Schema::create('products', function (Blueprint $table) {
    $table->bigInteger('cost')->unsigned();
    $table->string('currency', 3);
});

use Nevadskiy\Money\Casts\AsMoney;

/**
 * The attributes that should be cast.
 *
 * @var array
 */
protected $casts = [
    'cost' => AsMoney::class.':[currency]',
];