$this->encodePrimaryKey($user->id), 'first_name' => $user->first_name ?: '', 'last_name' => $user->last_name ?: '', 'email' => $user->email ?: '', 'last_login' => $user->last_login ?: '', 'updated_at' => $user->updated_at, 'deleted_at' => $user->deleted_at, 'phone' => $user->phone ?: '', 'email_verified_at' => $user->email_verified_at ?: '', 'signature' => $user->signature ?: '', ]; } 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->user_companies, $transformer, CompanyUser::class); } }