%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/geotechnics/api/app/Transformers/
Upload File :
Create Path :
Current File : /var/www/html/geotechnics/api/app/Transformers/CompanyProfileTransformer.php

<?php

namespace App\Transformers;

use App\Models\CompanyProfile;

class CompanyProfileTransformer extends BaseTransformer
{
    protected $defaultIncludes = [
        'country',
    ];

    public function includeCountry(CompanyProfile $profile)
    {
        if ($country = $profile->country) {
            return $this->item($country, new CountryTransformer(), 'country');
        }
        return null;
    }

    /**
     * CompanyProfile $profile
     *
     * @param CompanyProfile $profile
     * @return array
     */
    public function transform(CompanyProfile $profile)
    {
        return [
            'id'         => $profile->id,
            'name'       => $profile->name,
            'company'    => $profile->company,
            'email'      => $profile->email,
            'phone'      => $profile->phone,
            'country_id' => $profile->country_id,
            'user_id'    => $profile->user_id,
            'city'       => $profile->city,
            'street'     => $profile->street,
            'zip_code'   => $profile->zip_code,
            'avatar'     => $profile->user->getAvatar(),
        ];
    }
}

Zerion Mini Shell 1.0