Skip to content
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

Files uploaded with Trix are not uploaded #119

Open
fkeloks opened this issue Apr 30, 2022 · 0 comments
Open

Files uploaded with Trix are not uploaded #119

fkeloks opened this issue Apr 30, 2022 · 0 comments

Comments

@fkeloks
Copy link

fkeloks commented Apr 30, 2022

Hello,

The upload of attachments (images or videos for example) does not work with the Trix editor (the default editor of Nova).

Example:

NovaSettings::addSettingsFields([
    Panel::make('Homepage - event 1', [
        Text::make('Name', 'event_1_name')->rules('required', 'max:100'),
        Trix::make('Description', 'event_1_description')->withFiles('public')->rules('required', 'max:64000'),
    ]),
]);

On upload, the request is:

Request URL: http://localhost:8000/nova-api/nova-settings/trix-attachment/event_1_description
Request Method: POST
Status Code: 404 Not Found

on vendor/laravel/nova/src/Http/Controllers/TrixAttachmentController.php:

    public function store(NovaRequest $request)
    {
        $field = $request->newResource()
                        ->availableFields($request)
                        ->findFieldByAttribute($request->field, function () {
                            abort(404);
                        });

        return response()->json(['url' => call_user_func(
            $field->attachCallback, $request
        )]);
    }

Indeed, instead of "value" (from the Settings model) the field is "event_1_description", which causes the 404 error and prevents the upload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant