onuraycicek/currency
最新稳定版本:0.0.13
Composer 安装命令:
composer require onuraycicek/currency
包简介
This is my package currency
README 文档
README
Installation
You can install the package via composer:
composer require onuraycicek/currency
php artisan vendor:publish --tag="currency-migrations" php artisan vendor:publish --tag="currency-config" php artisan vendor:publish --tag="currency-seeder" php artisan migrate php artisan db:seed --class=CurrencySeeder
You must be add this libs: Bootstrap 5, Jquery, Select2.
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
Finally you must be add the end (footer) of the layout file: (it's required when you want to use "select-active" attribute)
@stack("footer")
Usage
<x-currency-table select-active></x-currency-table>
Attributes:
select-active: It adds a selectbox above the table so you can check your currencies activity values.
$fromId = 53; $toId = 155; $amount = 100; echo \Onuraycicek\Currency\Currency::convertWithId($fromId, $toId, $amount); $fromCurrencyCode = 'TRY'; $toCurrencyCode = 'USD'; $amount = 100; echo \Onuraycicek\Currency\Currency::convert($fromCurrencyCode, $toCurrencyCode, $amount); var_dump(\Onuraycicek\Currency\Currency::getActiveCurrencies()); $currencyCode = 'TRY'; var_dump(\Onuraycicek\Currency\Currency::getCurrency('TRY')); $currencyId = 1; var_dump(\Onuraycicek\Currency\Currency::getCurrencyById($currencyId)); var_dump(\Onuraycicek\Currency\Models\Currency::all());
Config
return [ 'theme' => 'bootstrap5', 'currencies' => ['TRY', 'USD', 'EUR'], // if it is null, currencies with status 1 will be shown. -> ('currencies' => null) ]; theme: bootstrap5, bootstrap4 (not supported yet) currencies: https://www.html-code-generator.com/php/array/currency-names
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 57
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-11
