get the id in the relation manager

i have this function in my status resurce relation manager
protected static function getCandidateOptions()
{
// Assuming you have access to the currently logged-in user
$loggedInUser = Auth::user();
if (!$loggedInUser) {
return [];
}
$company = $loggedInUser->company;
if (!$company) {
return [];
}
$jobs = $company->jobs;
$options = [];
foreach ($jobs as $job) {

$jobApplications = $job->jobapplications;

foreach ($jobApplications as $jobApplication) {
$candidate = $jobApplication->candidate;

if ($candidate) {
$user = $candidate->user;

if ($user) {
$options[$jobApplication->id] = $user->name;
}
}
}
}
return $options;
}
i have relation like this status->jobapplicatoin->job->id to get the jobId
how can i access the jobId dynamicly
like when i view the job and go to status, i can see the the status only for this job
Was this page helpful?