I'm trying to get this hasOne to work, and it does in tinker, but not on the request from postman.
{
return $this->hasMany(PitchForm::class);
}
public function primaryForm(): HasOne
{
return $this->forms()->where('language_code', $this->primary_language)->one();
}
These are the relations on the "pitch"
{
return $this->belongsTo(Pitch::class);
}```
Inverse on the pitchForm
``` 'form' => $this->when($isPitch, PitchFormResource::make($this->whenLoaded('primaryForm'))),```
This returns null always...
```Pitch::find(5)->primaryForm``` But this in tinker returns the form... What am I doing wrong in the resource??? I have tried a million things and nothing seems to change it. I have dd'ed the query, which is correct, the bindings are correct, but the result is null, the bindings are language_code = 'en-EN' and pitch_id = 5 in this instance... I have tried copy pasting the query to table plus and again it works as expected....