php - how to perform this join in laravel -


i have table in database called jobcardops , model jobcardop.php. fields of table include opnum, jobcardnum, prevopnum, opstatus. row uniquely identified jobcardnum , opnum pair. now, considered having field called previousopstatus contains status of previous op, wondered whether join.

so clarify, when retrieve group of jobcardop models database want add field on end; 'previousopstatus'. know ill need like;

 $ops = jobcardop::where('jobcardnum', '=', $somejobnum)   ->join('jobcardops jobcardops_1, constraint)   ->select('jobcardops.*', 'jobcardops_1.opstatus previousopstatus')   ->get(); 

where jobcardops_1 somehow offset 1 if makes sense. can if can done?

thanks


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -