One To many relation editing in wire model

What seems to be the problem:

How could i get the img path from the productimage table, that has a relation many to one with products table and pass it to the wire model?

Steps to Reproduce:

Are you using the latest version of Livewire:
Yes

Do you have any screenshots or code examples:

With the little that talked about your need I will try to help you reach the solution

Because there are some ways

Seeing your image I imagine you want to list the products

I would not solve this in the component
I would pass the list on to the component
(but this is how i would
separate responsibilities)

And thinking like that …
think of laravel, not livewire

the manyToOne relationship has already been made in the module

the component should already receive this list with this

Something like…
$products = Product::with('product-image')->get();

Doing this in the controller you can pass as a parameter to the component

Ps. This is not the only way … it is just a way of doing

Take a look at:
https://laravel.com/docs/8.x/eloquent-relationships#one-to-many-inverse

No i’m not trying to list the products, i’m triyng to edit a single product.

The controller you see in the img get the single product from the route, the route is:

Route::get(‘admin/{product}’, AdminEdit::class);

The relation is working using standard Laravel’s method without Livewire.

I don’t know how to “mount” releted img_path in $this->editing

see if this is what you need
If not, talk more about the final result you want

I’m sorry if I still don’t understand your problem, I’m just trying to help

public function getProductImageAttribute()
{
     return Storage::url($this->image_name());
}

getProductImageAttribute is an attribute that you can place in your product model

this will create an attribute called product_image

and you will be able to access this property in the view and show the image