sifangpay/app/Models/BankTransfer.php

36 lines
901 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class BankTransfer extends BaseModel
{
//
use SoftDeletes;
public $appends=['api_pic'];
public function getApiPicAttribute()
{
$http_url=url('/');
return $this->thumb?$http_url.$this->thumb:"";
}
public function getTypeNameAttribute(){
return config('adconfig.transfer_type')[$this->type];
}
public static function getListToType(){
$gateways = self::where('is_checked', 1)->orderBy('type', 'desc')->orderBy('id', 'desc')->get();//
$arr = [];
if (count($gateways) > 0) {
foreach ($gateways as $k => $v) {
$arr[$v->type]['name']=config('adconfig.transfer_type')[$v->type];
$arr[$v->type]['data'][]=$v;
}
}
return $arr;
}
}