1234567891011121314151617181920212223 |
- <?php
- namespace app\data\model\helpers;
- use think\db\Query;
- /**
- * @method Query|static show()
- */
- trait PurchaseItemEnclosure{
- public function getEnclosureAttr($file){
- $files=json_decode($file,true)?:[];
- foreach ($files as &$file){
- if(isset($file['icon'])){
- $file['icon']=sprintf('%s/static/images/ext/pdf.png',request()->domain());
- }
- }
- return $files;
- }
- public function setEnclosureAttr($file){
- return json_encode($file?:[],256);
- }
- }
|