2026-01-17 17:44:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
refactor: settings redesign, Spanish translations, language system, strict_types
Settings pages:
- Redesign layout to match Sendkit (max-w-4xl, space-y-12, Separator sections)
- Merge Members page into Workspace settings with Table, invite Dialog, ConfirmDeleteModal
- Add workspace logo upload/delete routes and controller methods
- Translate all hardcoded strings in Workspace.vue modals
Language system:
- Drop languages table, replace language_id FK with locale string column on users
- Create config/languages.php for available languages and default locale
- Add Spanish (es) translations (13 files)
- Simplify HandleInertiaRequests, ProfileController, RegisteredUserController
Code quality:
- Add declare(strict_types=1) to all PHP files
- Fix MastodonPublisher using wrong attribute (filename -> original_filename)
- Fix HasMediaTest for new has_photo/photo_url accessors
- Fix PublishToSocialPlatformTest type error revealed by strict_types
- Remove orphaned Language model from AppServiceProvider morph map
- Update User TypeScript interface (has_photo, photo_url, locale)
- Eager load media relation on workspaces to prevent N+1
- Add 8 new tests for workspace logo upload/delete
- Update workspace settings test to assert members/invitations props
All 710 tests passing.
2026-03-30 03:20:43 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-01-17 17:44:37 +00:00
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
|
|
use App\Enums\Media\Type as MediaType;
|
|
|
|
|
use App\Models\Media;
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
|
|
/**
|
2026-03-29 22:24:28 +00:00
|
|
|
* @extends Factory<Media>
|
2026-01-17 17:44:37 +00:00
|
|
|
*/
|
|
|
|
|
class MediaFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
protected $model = Media::class;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array<string, mixed>
|
|
|
|
|
*/
|
|
|
|
|
public function definition(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'collection' => 'default',
|
|
|
|
|
'type' => MediaType::Image,
|
|
|
|
|
'path' => 'media/'.now()->format('Y-m').'/'.$this->faker->uuid().'.jpg',
|
|
|
|
|
'original_filename' => $this->faker->word().'.jpg',
|
|
|
|
|
'mime_type' => 'image/jpeg',
|
|
|
|
|
'size' => $this->faker->numberBetween(10000, 5000000),
|
|
|
|
|
'order' => 0,
|
|
|
|
|
'meta' => [
|
|
|
|
|
'width' => 1920,
|
|
|
|
|
'height' => 1080,
|
|
|
|
|
],
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function video(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'type' => MediaType::Video,
|
|
|
|
|
'path' => 'media/'.now()->format('Y-m').'/'.$this->faker->uuid().'.mp4',
|
|
|
|
|
'original_filename' => $this->faker->word().'.mp4',
|
|
|
|
|
'mime_type' => 'video/mp4',
|
|
|
|
|
'meta' => [
|
|
|
|
|
'duration' => $this->faker->numberBetween(10, 300),
|
|
|
|
|
],
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
feat: Asset Library list, preview, and attach via API and MCP (#282)
* feat: list, preview, and attach Asset Library media via API and MCP
Let API and MCP clients reuse workspace assets instead of re-uploading, sharing the same scoped query, signed preview, and idempotent attach path.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Align Asset Library API and MCP with main media patterns.
Drop the signed-preview stack, return Storage URLs and PostResource like existing attach flows, and query medias by morph owner instead of getMedia().
Co-authored-by: Cursor <cursoragent@cursor.com>
* Paginate workspace assets with the app default page size.
Keep list pagination in the action via config('app.pagination.default') instead of a hardcoded API page size.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Move asset API and MCP input rules into FormRequests.
Keep controllers and tools free of inline field validation; MCP tools reuse the request rule definitions.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Document asset MCP tools with explicit parameters and constraints.
Spell out workspace scope, return fields, sibling tools, and rejection cases so agents can call list/get/attach without guessing.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Harden asset attach against races and keep library metadata on the post.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Relock the library asset on attach so a deleted file cannot land on the post.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Document that omitting alt on attach keeps the library alt text.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-16 20:08:20 +00:00
|
|
|
public function assets(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'collection' => 'assets',
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function document(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'type' => MediaType::Document,
|
|
|
|
|
'path' => 'media/'.now()->format('Y-m').'/'.$this->faker->uuid().'.pdf',
|
|
|
|
|
'original_filename' => $this->faker->word().'.pdf',
|
|
|
|
|
'mime_type' => 'application/pdf',
|
|
|
|
|
'meta' => [],
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-17 17:44:37 +00:00
|
|
|
public function logo(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'collection' => 'logo',
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function avatar(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'collection' => 'avatar',
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|