Skip to content

Commit d08b408

Browse files
authored
Merge pull request #95 from cslant/feature/add-seo-image-for-meta-box
Feature/add seo image for meta box
2 parents eedfca5 + 6603443 commit d08b408

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/Http/Resources/MetaBox/MetaBoxCustomResource.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace CSlant\Blog\Api\Http\Resources\MetaBox;
44

5+
use CSlant\Blog\Core\Facades\Base\Media\RvMedia;
56
use CSlant\Blog\Core\Models\MetaBox;
67
use Illuminate\Http\Request;
78
use Illuminate\Http\Resources\Json\JsonResource;
@@ -30,6 +31,7 @@ public function toArray(Request $request): array
3031
?? (property_exists($reference, 'name') ? substr($reference->name, 0, 65) : null);
3132
$metaValueCustom['seo_description'] = $metaValueCustom['seo_description']
3233
?? (property_exists($reference, 'description') ? substr($reference->description, 0, 300) : null);
34+
$metaValueCustom['seo_image'] = !empty($metaValueCustom['seo_image']) ? (RvMedia::getImageUrl($metaValueCustom['seo_image'], '', false, RvMedia::getDefaultImage()) ?? '') : null;
3335
}
3436

3537
return [

src/OpenApi/Schemas/Attributes/MetaBox/MetaBoxValueAttributeSchema.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
properties: [
1212
new Property(property: "seo_title", description: "SEO title", type: "string", maxLength: 255),
1313
new Property(property: "seo_description", description: "SEO description", type: "string", maxLength: 255),
14+
new Property(property: "seo_image", description: "SEO Image", type: "string", maxLength: 255),
1415
new Property(property: "index", description: "Index", type: "string", maxLength: 255),
1516
],
1617
type: "object"

0 commit comments

Comments
 (0)