mercredi 23 décembre 2015

Trying to avoid Subquery in the Select Statement : Laravel 5.1

I am using Laravel 5.1. below is my Database query

\App\Models\Project\Bids\ProjectBid_Model
::with(['Project' => function($query){
    $query->where('WhoCreatedTheProject', 16);
}])
->where('ProjectBidID', 1)
->where('FreelancerAwardedProjectStatusID', \App\ProjectStatus::InProgress)
->first()

What's the Question ?

In the below part, if there exists no record, then the Project Object will be null. This seems a sub query in the select statement. Is there any way to return overall no record if 'WhoCreatedTheProjectvalue does not match in the database ? I meant I am looking forInner Join`.

::with(['Project' => function($query){
    $query->where('WhoCreatedTheProject', 16);
}])



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire