is it possible to create a Relationship Manager on Collection

I have the following relationship in my warehouse.php model.
public function products()
{
// logic to find all products inside the warehouse
return Product::
...
...
...
}
public function products()
{
// logic to find all products inside the warehouse
return Product::
...
...
...
}
I tried creating a relationship manager on the WarehouseResouce but I get the following error Method Illuminate\Database\Eloquent\Collection::getQuery does not exist. Not sure if its possible to create a "Relationship managment" from Collection ?
1 Reply
awcodes
awcodes5d ago
The relationship needs to return the actually relationship ie return $this->hasMany(Product::class) your relationship isn’t defined based on laravel standards.
Want results from more Discord servers?
Add your server