Add LinkedIn document posts — the swipeable PDF carousel — for both personal profiles and company pages. This is the format every major competitor exposes via native PDF upload, and the reason a trial user churned.
- New 'document' media type (application/pdf) across the upload pipeline (Type enum, HasMedia, FormRequests incl. chunked, Platform media types)
- New LinkedInDocument / LinkedInPageDocument content types: PDF-only, single-file, with a supportsDocument() flag
- Publisher flow: documents initializeUpload -> PUT -> poll AVAILABLE -> post with content.media.{id,title}; optional document_title meta (falls back to file name)
- PDF is mutually exclusive with image/video, enforced in ContentTypeCompatibleWithMedia
- Frontend: 'Document (PDF)' variant, media rules (100MB cap), composer/gallery/detail PDF cards, real PDF embed in the LinkedIn editor preview, i18n in en/es/pt-BR
- Tests: publishers (personal + page, incl. processing-failure path), enums, compatibility rule, chunked PDF upload, API + MCP document_title round-trip
LinkedIn caps documents at 100MB / 300 pages (Documents API). The page limit is enforced by LinkedIn at publish, not validated client-side.
39 lines
842 B
PHP
39 lines
842 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Api;
|
|
|
|
use App\Enums\Media\Type as MediaType;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreUploadRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
$allowed = implode(',', array_merge(
|
|
MediaType::Image->allowedMimeTypes(),
|
|
MediaType::Video->allowedMimeTypes(),
|
|
MediaType::Document->allowedMimeTypes(),
|
|
));
|
|
|
|
$maxKb = (int) config('ai.mcp.upload.max_size_mb') * 1024;
|
|
|
|
return [
|
|
'media' => [
|
|
'required',
|
|
'file',
|
|
"max:{$maxKb}",
|
|
"mimetypes:{$allowed}",
|
|
],
|
|
];
|
|
}
|
|
}
|