-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Package remove images from Trix #83
Comments
any update here? |
That's because Nova is unable to save the image as it errors out with a 404. I just ran into the same issue. The use Illuminate\Http\JsonResponse;
use Illuminate\Http\Response;
use Laravel\Nova\Http\Controllers\FieldAttachmentController as Controller;
use Laravel\Nova\Http\Requests\NovaRequest;
final class FieldAttachmentController extends Controller
{
private const TRANSLATABLE_SEPARATOR = '.';
public function destroyAttachment(NovaRequest $request): Response
{
return parent::destroyAttachment($this->normalizeFieldAttributeName($request));
}
public function destroyPending(NovaRequest $request): Response
{
return parent::destroyPending($this->normalizeFieldAttributeName($request));
}
public function store(NovaRequest $request): JsonResponse
{
return parent::store($this->normalizeFieldAttributeName($request));
}
private function normalizeFieldAttributeName(NovaRequest $request): NovaRequest
{
return $request->merge([
'field' => current(explode(self::TRANSLATABLE_SEPARATOR, $request->route('field', ''), 2))
]);
}
} Register it as a singleton in your final class NovaServiceProvider extends NovaApplicationServiceProvider
{
public array $singletons = [
\Laravel\Nova\Http\Controllers\FieldAttachmentController::class => \App\Nova\Controllers\FieldAttachmentController::class,
];
// ...
} |
when save resource, in trix field with ->translatable() all images are deleted
The text was updated successfully, but these errors were encountered: