ok

Mini Shell

Direktori : /home2/selectio/public_html/limpiar.in.net/app/Http/Resources/V2/
Upload File :
Current File : /home2/selectio/public_html/limpiar.in.net/app/Http/Resources/V2/AuctionMiniCollection.php

<?php

namespace App\Http\Resources\V2;

use Illuminate\Http\Resources\Json\ResourceCollection;

class AuctionMiniCollection extends ResourceCollection
{
    public function toArray($request)
    {
        return [
            'data' => $this->collection->map(function ($data) {


                return [
                    'id' => $data->id,
                    'name' => $data->getTranslation('name'),
                    'thumbnail_image' => uploaded_asset($data->thumbnail_img),
                    'has_discount' => home_base_price($data, false) != home_discounted_base_price($data, false),
                    // 'discount' => "-" . discount_in_percentage($data) . "%",
                    // 'stroked_price' => home_base_price($data),
                    'main_price' => single_price($data->starting_bid),
                    'rating' => (float) $data->rating,
                    'sales' => (int) $data->num_of_sale,
                    'links' => [
                        'details' => route('products.show', $data->id),
                    ]
                ];
            })
        ];
    }

    public function with($request)
    {
        return [
            'success' => true,
            'status' => 200
        ];
    }
}

Zerion Mini Shell 1.0