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