I have three tables :
candidates :
id (int)
name (varchar)
and
available_jobs:
id (int)
title (varchar)
and the pivot table where the candidate can apply for job
job_applications:
id (int)
candidate_id (int) foreign key reference candidate(id),
available_jobs_id (int) oreign key reference available_jobs(id),
this is my function for deleting candidates :
public function destroy (Candidate $candidate){
$candidate->delete();
}
as will as deleting an available_job :
public function destroy (AvailableJob $job){
$job->delete();
}
My question is how to type hint and delete the applications!
I know that I can delete the application using ( where close ) by specifying the candidate_id and the available_jobs_id but I am asking if there is another way like type-hinting or something like that!