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

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -