withoutWrapping(); $promotion = null; if($this->promotion_id != 0) { if(isset($this->promotion->is_active) && $this->promotion->is_active == 1) { $promotion = array( 'promotion_uuid' => $this->promotion->promotion_uuid, 'title' => $this->promotion->title, 'date_start' => $this->promotion->date_start, 'date_end' => $this->promotion->date_end, ); } } return [ 'photoslider_uuid' => $this->photoslider_uuid, 'type' => $this->promotion_id != 0 ? 'Promo' : 'Non-Promo', 'promotion' => $promotion, 'title' => $this->title, 'description' => $this->description, 'image' => $this->image != '' ? S3::public_path($this->image) : null, 'date_start' => $this->date_start, 'date_end' => $this->date_end, 'created_at' => $this->created_at != null ? $this->created_at->toDateTimeString() : null, 'updated_at' => $this->updated_at != null ? $this->updated_at->toDateTimeString() : null, 'created_by' => $this->created_by != 0 ? CurrentUserHelper::getAdminName($this->created_by) : null, 'updated_by' => $this->updated_by != 0 ? CurrentUserHelper::getAdminName($this->updated_by) : null, ]; } }