where('mediable_type', Relation::getMorphAlias(Workspace::class)) ->where('mediable_id', $workspace->id) ->where('collection', 'assets') ->whereKey($assetId) ->when($lockForUpdate, fn (Builder $query) => $query->lockForUpdate()) ->first(); } }