mjawad096 / laravel-grapesjs

This package provide an esay way to integrate GrapesJS into your laravel proejct.
MIT License
109 stars 54 forks source link

Missing required parameter #83

Open ltib91 opened 7 months ago

ltib91 commented 7 months ago

Hi,

I am getting this error, doing everything like in the readme instructions.

Illuminate\Routing\Exceptions\UrlGenerationException Missing required parameter for [Route: laravel-grapesjs.model.templates] [URI: laravel-grapesjs/{model}/{editable}/templates] [Missing parameter: editable]. screencapture-localhost-8888-admin-products-3-editor-2024-02-27-14_39_59

ap1969 commented 7 months ago

I get the same problem. Any luck resolving it?

ltib91 commented 7 months ago

@ap1969 I used for Product, here is my working solution:

Product Controller:

protected function setupEditorRoutes($segment, $routeName, $controller) {
    Route::get($segment.'/{id}/editor', [
        'as'        => $routeName.'.editor',
        'uses'      => $controller.'@editor',
        'operation' => 'editor',
    ]);
}

public function editor(Request $request) {
    $product = Product::find($request->id);
    return $this->show_gjs_editor($request, $product);
}

Product Model:

public function getKeyValue(){
    return $this->id;
}