Icon Path Added

This commit is contained in:
devansh bawari 2021-04-19 13:43:36 +05:30
parent 85f3fece81
commit d359d95c36
1 changed files with 21 additions and 17 deletions

View File

@ -2,6 +2,7 @@
namespace Webkul\API\Http\Resources\Catalog;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\Resources\Json\JsonResource;
class Category extends JsonResource
@ -15,22 +16,25 @@ class Category extends JsonResource
public function toArray($request)
{
return [
'id' => $this->id,
'code' => $this->code,
'name' => $this->name,
'slug' => $this->slug,
'display_mode' => $this->display_mode,
'description' => $this->description,
'meta_title' => $this->meta_title,
'meta_description' => $this->meta_description,
'meta_keywords' => $this->meta_keywords,
'status' => $this->status,
'image_url' => $this->image_url,
'additional' => is_array($this->resource->additional)
? $this->resource->additional
: json_decode($this->resource->additional, true),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'id' => $this->id,
'code' => $this->code,
'name' => $this->name,
'slug' => $this->slug,
'display_mode' => $this->display_mode,
'description' => $this->description,
'meta_title' => $this->meta_title,
'meta_description' => $this->meta_description,
'meta_keywords' => $this->meta_keywords,
'status' => $this->status,
'image_url' => $this->image_url,
'category_icon_path' => $this->category_icon_path
? Storage::url($this->category_icon_path)
: null,
'additional' => is_array($this->resource->additional)
? $this->resource->additional
: json_decode($this->resource->additional, true),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}
}