fix(mcp): use morph alias for mediable_type to match production storage

This commit is contained in:
Paulo Castellano 2026-05-15 16:34:25 -03:00
parent dd1056a413
commit 41a704dc6a
2 changed files with 3 additions and 3 deletions

View file

@ -36,7 +36,7 @@ public function handle(Request $request): Response|ResponseFactory
$media = Media::query()
->where('upload_token', data_get($validated, 'upload_token'))
->where('mediable_type', Workspace::class)
->where('mediable_type', (new Workspace)->getMorphClass())
->where('mediable_id', $workspaceId)
->first();

View file

@ -24,7 +24,7 @@
$this->token = (string) Str::uuid();
$this->media = Media::factory()->create([
'mediable_type' => Workspace::class,
'mediable_type' => (new Workspace)->getMorphClass(),
'mediable_id' => $this->workspace->id,
'collection' => 'assets',
'upload_token' => $this->token,
@ -48,7 +48,7 @@
$foreignToken = (string) Str::uuid();
Media::factory()->create([
'mediable_type' => Workspace::class,
'mediable_type' => (new Workspace)->getMorphClass(),
'mediable_id' => $otherWs->id,
'collection' => 'assets',
'upload_token' => $foreignToken,