6
0
Fork 0
jiqu-library-server/app/Endpoint/Api/Http/Resources/Dealer/DealerResource.php

29 lines
953 B
PHP

<?php
namespace App\Endpoint\Api\Http\Resources\Dealer;
use App\Models\DealerWalletToBankLog;
use Illuminate\Http\Resources\Json\JsonResource;
class DealerResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'lvl' => $this->lvl,
'lvl_name'=> $this->lvl_text,
'sale_values'=> $this->sale_values, //团队销售业绩基数
'guanli_values'=> $this->calculate_total_amount, //预计管理津贴
'team_sales_value' => $this->team_sales_value,
'pay_info'=>$this->pay_info ?: null,
'can_withdraw'=> DealerWalletToBankLog::where('user_id', $this->user_id)->where('created_at', '>', now()->subDays(7))->doesntExist(),
];
}
}