File: D:/HostingSpaces/SBogers10/werkenbijkemtec.komma.pro/app/Users/Resources/UserResource.php
<?php
namespace App\Users\Resources;
use Illuminate\Http\Resources\Json\Resource;
class UserResource extends Resource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
'role' => $this->whenLoaded('role', new RoleResource($this->role)),
'email' => $this->email,
'first_name' => $this->first_name,
'last_name' => $this->last_name,
'culture' => $this->culture,
'company_name' => $this->when(isset($this->company_name), ''),
'chamber_of_commerce' => $this->when(isset($this->chamber_of_commerce), ''),
'company_street' => $this->when(isset($this->company_street), ''),
'company_house_number' => $this->when(isset($this->company_house_number), ''),
'company_city' => $this->when(isset($this->company_city), ''),
'company_postal_code' => $this->when(isset($this->company_postal_code), ''),
'company_country' => $this->when(isset($this->company_country), ''),
'company_vat_number' => $this->when(isset($this->company_vat_number), ''),
'company_vat_number_validated' => $this->when(isset($this->company_vat_number_validated), ''),
'street' => $this->when(isset($this->street), ''),
'house_number' => $this->when(isset($this->house_number), ''),
'postal_code' => $this->when(isset($this->postal_code), ''),
'city' => $this->when(isset($this->city), ''),
'telephone' => $this->when(isset($this->telephone), ''),
];
}
}