Right now by setting up belongsTo relation in laravel nova resource I am getting option values as ID's, but instead I need plan_service_id and I am not sure how to achieve this... Code:
Nova TeamSubscriptionResource:
public function fields(Request $request)
{
return [
BelongsTo::make('Plan', 'plan', 'App\Nova\Plan')->display('name'),
];
}
Plan model:
public function teamSubscriptions()
{
return $this->hasMany('App\TeamSubscription', 'stripe_plan', 'plan_service_id');
}
TeamSubscription model:
public function plan()
{
return $this->belongsTo('App\Plan', 'stripe_plan', 'plan_service_id');
}
}
Current result option value is filled with $plan->id:
Result wanted, option value should be filled with $plan->plan_service_id: