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.
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\App\Asset;
|
|
|
|
use App\Enums\Media\Type as MediaType;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreAssetRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$allowedMimes = [...MediaType::Image->allowedMimeTypes(), ...MediaType::Video->allowedMimeTypes(), ...MediaType::Document->allowedMimeTypes()];
|
|
|
|
return [
|
|
// Use the largest per-type cap as the upper bound; per-type
|
|
// enforcement happens after the upload via the Media model.
|
|
'media' => [
|
|
'required',
|
|
'file',
|
|
'max:'.MediaType::Video->maxSizeInKb(),
|
|
'mimetypes:'.implode(',', $allowedMimes),
|
|
],
|
|
'meta' => ['sometimes', 'array'],
|
|
'meta.width' => ['sometimes', 'integer', 'min:1'],
|
|
'meta.height' => ['sometimes', 'integer', 'min:1'],
|
|
'meta.duration' => ['sometimes', 'numeric', 'min:0'],
|
|
];
|
|
}
|
|
}
|