芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/qrafiqxcreativeagency.com/accounts/office/app/Models/ProposalItem.php
hasOne(ProposalItemImage::class, 'proposal_item_id'); } public static function taxbyid($id) { return Tax::where('id', $id)->withTrashed(); } public function unit(): BelongsTo { return $this->belongsTo(UnitType::class, 'unit_id'); } public function getTaxListAttribute() { $proposalItem = ProposalItem::findOrFail($this->id); $taxes = ''; if ($proposalItem && $proposalItem->taxes) { $numItems = count(json_decode($proposalItem->taxes)); if (!is_null($proposalItem->taxes)) { foreach (json_decode($proposalItem->taxes) as $index => $tax) { $tax = $this->taxbyid($tax)->first(); $taxes .= $tax->tax_name . ': ' . $tax->rate_percent . '%'; $taxes = ($index + 1 != $numItems) ? $taxes . ', ' : $taxes; } } } return $taxes; } }