I want to use hasMany relation with raw sql foreign key and local key. I have to relate them on the basis of date that's why I have to use raw sql functions as foreign key and local key.
I've tried to customize the hasMany relation but no success.
public function auctionVehicles()
{
return $this->customHasMany(
'App\Models\ManheimVehicle',
\DB::raw("SUBSTRING(sale_date, 1, 10)"),
\DB::raw("DATE_FORMAT(
STR_TO_DATE(auction_date,'%b %d, %Y'), '%d/%m/%Y')")
)
);
}
Is this possible?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire