laravel - Querying with Eloquent - Achieve Join -


how select records db situation below using eloquent

tables:

employee table [ id,name]

address table [id,address_line1,employee_id,city_id]

city table [id,name]

a query below return city id, need city name well

$employee = employee::with('address')->get(); 

and employee model have relationship

public function address(){ $this->hasmany('address'); } 

how achieve desired result output of query should give me city name city table, based on id address table, without running new query each city id names


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -