* @license GPL https://xxx.com * @link https://xxx.com * @ctime: 2020/3/23 9:24 */ namespace App\Transformers; use App\Models\WalletLog; use League\Fractal\TransformerAbstract; class WalletLogTransformer extends TransformerAbstract { public function transform(WalletLog $walletLog) { return [ 'id' => $walletLog->id, 'name' => $walletLog->name, 'operate_type' => WalletLog::$operateTypeMaps[$walletLog->operate_type], 'money' => $walletLog->money, 'created_at' => $walletLog->created_at->format('Y-m-d H:i:s'), ]; } }