Open mvysh opened 8 years ago
I figured out how to add two filter fields by applicant. I've created duplicate relation for the model with other name. I've also suceeded in adding customers relation directly to registration (in framework it works fine).
public function customer()
{
if(empty($this->created_at)) return;
return $this->applicant->belongsTo('App\Models\Customer');
}
But in admin I have next error:
The 'customer' relationship field you supplied for registrations is not a valid relationship method name on the supplied Eloquent model
Is it possible to filter by muliple fields from one relation and not them to be overridden (because of same key for relationship name)? Can nested relations be used? Example. Applicant belongsTo Customer, Applicant hasOne Registration. 1) Can I filter on both applicant.name and applicant.surname from registration? 2) Filter by customer.name from registrations (registration -> applicant -> customer.name).