Posts get a nullable image_url. WordPressPublisher now downloads it and uploads it to WordPress's media endpoint before creating the post, setting it as featured_media — and rejects publishing (without touching status) if a blog post has no image set, mirroring the existing title requirement. Every other network treats it as optional. Not enforced at save time, same as title — you can still draft an incomplete WordPress post, it just can't be published until an image is set. Exposed through the UI form (with a thumbnail/""missing"" indicator in the table), the JSON API, and the Python CLI wrapper. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
30 lines
868 B
PHP
30 lines
868 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class PostResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'site_id' => $this->site_id,
|
|
'social_account_id' => $this->social_account_id,
|
|
'type' => $this->type,
|
|
'title' => $this->title,
|
|
'body' => $this->body,
|
|
'target' => $this->target,
|
|
'image_url' => $this->image_url,
|
|
'status' => $this->status,
|
|
'scheduled_at' => $this->scheduled_at,
|
|
'published_url' => $this->published_url,
|
|
'publish_error' => $this->publish_error,
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|