Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. $candidates = Job::where('enterprise_id', $enterprise_id)
  2. ->where('id', $jobid)
  3. ->with('candidates')
  4. ->first();
  5.  
  6. AppJob
  7.  
  8. public function candidates(){ //llamar candidates desde el with del controlador.
  9. //En este modelo necesito hacer paginación, ya que es donde se obtenien más resultados, en tabla muchos a muchos.
  10. return $this->hasMany('AppJobCandidate')->with('candidate');
  11. }
  12.  
  13.  
  14. AppJobCandidate
  15.  
  16. public function candidate(){ //llamar candidate desde el modelo AppJob
  17. //Obtención de información de usuario.
  18. return $this->hasOne('AppUser', 'id', 'user_id');
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement