mercredi 24 mai 2017

Laravel 5.4 eloquent using with and where

I want to get Data if join table not null so i do a query like this

 $projects = Project::
            with(array('owner'=> function($query) use ($request){
                $query->where('owner_id',$request->input('owner_id'));
            }))->with('plans')->get();

i get all projects with owners if not null and plans but, i want to get projects if owners not null

enter image description here

so if owner null i want not get project i want to get null [] .

How to resolve this issue and thanks



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2qPyyJR
via IFTTT

Aucun commentaire:

Enregistrer un commentaire