$this->encodePrimaryKey($user->id), 'first_name' => $user->first_name ?: '', 'last_name' => $user->last_name ?: '', 'email' => $user->email ?: '', 'last_login' => Carbon::parse($user->last_login)->timestamp, 'created_at' => (int)$user->created_at, 'updated_at' => (int)$user->updated_at, 'archived_at' => (int)$user->deleted_at, 'created_at' => (int)$user->created_at, 'is_deleted' => (bool)$user->is_deleted, 'phone' => $user->phone ?: '', 'email_verified_at' => $user->getEmailVerifiedAt(), 'signature' => $user->signature ?: '', 'custom_value1' => $user->custom_value1 ?: '', 'custom_value2' => $user->custom_value2 ?: '', 'custom_value3' => $user->custom_value3 ?: '', 'custom_value4' => $user->custom_value4 ?: '', ]; } public function includeCompanies(User $user) { $transformer = new CompanyTransformer($this->serializer); return $this->includeCollection($user->companies, $transformer, Company::class); } public function includeToken(User $user) { $transformer = new CompanyTokenTransformer($this->serializer); return $this->includeItem($user->token, $transformer, CompanyToken::class); } public function includeCompanyTokens(User $user) { $transformer = new CompanyTokenTransformer($this->serializer); return $this->includeCollection($user->tokens, $transformer, CompanyToken::class); } public function includeCompanyUsers(User $user) { $transformer = new CompanyUserTransformer($this->serializer); return $this->includeCollection($user->company_users, $transformer, CompanyUser::class); } public function includeCompanyUser(User $user) { $transformer = new CompanyUserTransformer($this->serializer); return $this->includeItem($user->company_user, $transformer, CompanyUser::class); } }