芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/kwesioben.com/paymoney/app/DataTables/Admin/CurrenciesDataTable.php
eloquent($this->query()) ->editColumn('name', function ($currency) { return (isset($currency->cryptoAssetSetting) && !empty($currency->cryptoAssetSetting)) ? $currency->name . '
(' . $currency->cryptoAssetSetting->cryptoProvider->name . ')' : $currency->name; }) ->editColumn('type', function ($currency) { return str_contains($currency->type, '_') ? ucwords(str_replace('_', ' ', $currency->type)) : ucfirst($currency->type); }) ->editColumn('rate', function ($currency) { return $currency->rate != 0 ? (float) ($currency->rate) : '-'; }) ->editColumn('logo', function ($currency) { return '
'; }) ->editColumn('status', function ($currency) { if ($currency->default == 1) { return '
Default Currency
'; } else { return getStatusLabel($currency->status); } }) ->addColumn('action', function ($currency) { $edit = $delete = $feesLimit = $pm = ''; $type = $currency->type == 'fiat' ? 'stripe' : 'coinpayments'; if ($currency->type == 'crypto_asset') { $edit = (Common::has_permission(auth('admin')->user()->id, 'edit_currency')) ? '
' : ''; } else { $edit = (Common::has_permission(auth('admin')->user()->id, 'edit_currency')) ? '
' : ''; } $delete = (Common::has_permission(auth('admin')->user()->id, 'delete_currency')) && (($currency->type == 'fiat') || ($currency->type == 'crypto')) ? '
' : ''; $feesLimit = (Common::has_permission(auth('admin')->user()->id, 'edit_currency') && $currency->status == 'Active') && (($currency->type == 'fiat') || ($currency->type == 'crypto')) ? '
Fees
' : ''; $pm = (Common::has_permission(auth('admin')->user()->id, 'edit_currency')) && $currency->status == 'Active' && (($currency->type == 'fiat') || ($currency->type == 'crypto')) ? '
Payment-Methods
' : ''; return $edit . $delete . $feesLimit . $pm; }) ->rawColumns(['name', 'logo', 'status', 'action']) ->make(true); } public function query() { $query = Currency::with('cryptoAssetSetting:id,currency_id,crypto_provider_id', 'cryptoAssetSetting.cryptoProvider:id,name')->select('id', 'type', 'name', 'code', 'symbol', 'rate', 'logo', 'status', 'default')->orderBy('id', 'desc'); return $this->applyScopes($query); } public function html() { return $this->builder() ->addColumn(['data' => 'id', 'name' => 'currencies.id', 'title' => __('ID'), 'searchable' => false, 'visible' => false]) ->addColumn(['data' => 'name', 'name' => 'currencies.name', 'title' => __('Name')]) ->addColumn(['data' => 'name', 'name' => 'cryptoAssetSetting.cryptoProvider.name', 'title' => __('Name'), 'visible' => false]) ->addColumn(['data' => 'code', 'name' => 'currencies.code', 'title' => __('Code')]) ->addColumn(['data' => 'symbol', 'name' => 'currencies.symbol', 'title' => __('Symbol')]) ->addColumn(['data' => 'type', 'name' => 'currencies.type', 'title' => __('Type')]) ->addColumn(['data' => 'rate', 'name' => 'currencies.rate', 'title' => __('Rate')]) ->addColumn(['data' => 'logo', 'name' => 'currencies.logo', 'title' => __('Logo')]) ->addColumn(['data' => 'status', 'name' => 'currencies.status', 'title' => __('Status')]) ->addColumn(['data' => 'action', 'name' => 'action', 'title' => __('Action'), 'orderable' => false, 'searchable' => false]) ->parameters(dataTableOptions([ "columnDefs" => [ [ "className" => "dt-center", "targets" => "_all" ] ] ])); } }