Laravel 5.4 call a model function on an instance returned by another laravel model function

     

I have 3 tables and the corresponding models which are connected as shown below:


Telephones.php:


namespace AppModels;  use IlluminateDatabaseEloquentModel;  class Telephones extends Model {   protected $table = 'telephones';   protected $primaryKey = 'telephone_id';   public function UserTelephone() {   return $this->hasOne('AppModelsUsers''user_id''user_id');   }  }  

Addresses.php:


namespace AppModels;  use IlluminateDatabaseEloquentModel;  class Addresses extends Model {   protected $table = 'addresses';   protected $primaryKey = 'address_id';   public function UserAddress() {   return $this ->hasOne('AppModelsUsers'