compoships
compoships copied to clipboard
HasOne results to an error
Error message
stripos(): Argument #1 ($haystack) must be of type string, array given
The code
use Awobaz\Compoships\Compoships;
public function transfer(): HasOne
{
return $this->hasOne(
Transfer::class,
['withdraw_id', 'deposit_id'],
['id', 'id']
);
}
Version of the package : 2.1.2 Laravel Version : 8.6
I got this error using MySql
@undjike Did you import the trait in the Transfer
class? Can you please show how you use the transfer
relationship?
Yes, I imported the trait on both classes
@undjike Can you please show a usage of the transfer
relationship?
@undjike Did you import the trait in the
Transfer
class? Can you please show how you use thetransfer
relationship?
I just eager loaded the transfer relation
$user->transactions()->with('transfer')->latest()->get()
@undjike A similar issue has been reported here https://github.com/topclaudy/compoships/issues/111. But I wasn't able to reproduce. Can you please share a simple Laravel project to reproduce the issue?
OK, I'll share later this evening.