diff --git a/beike/Admin/Http/Resources/TaxClassDetail.php b/beike/Admin/Http/Resources/TaxClassDetail.php index f37d8a72..ebab13bc 100644 --- a/beike/Admin/Http/Resources/TaxClassDetail.php +++ b/beike/Admin/Http/Resources/TaxClassDetail.php @@ -19,10 +19,12 @@ class TaxClassDetail extends JsonResource { return [ 'id' => $this->id, - 'name' => $this->title, + 'title' => $this->title, 'description' => sub_string($this->description), 'created_at' => time_format($this->created_at), 'updated_at' => time_format($this->updated_at), + 'tax_rates' => $this->taxRates->toArray(), + 'tax_rules' => $this->taxRules->toArray(), ]; } } diff --git a/beike/Admin/Repositories/TaxClassRepo.php b/beike/Admin/Repositories/TaxClassRepo.php index 748407d8..e795ff5d 100644 --- a/beike/Admin/Repositories/TaxClassRepo.php +++ b/beike/Admin/Repositories/TaxClassRepo.php @@ -11,6 +11,7 @@ namespace Beike\Admin\Repositories; +use Beike\Admin\Http\Resources\TaxClassDetail; use Beike\Models\TaxClass; class TaxClassRepo @@ -19,10 +20,12 @@ class TaxClassRepo public static function getList() { - return TaxClass::query()->with([ + $taxClass = TaxClass::query()->with([ 'taxRates.region', 'taxRules' ])->get(); + + return TaxClassDetail::collection($taxClass)->jsonSerialize(); } public static function createOrUpdate($data)