It doesn’t work that way in Laravel.
Relationships are represented as follows (in your case):
class Usuario extends Eloquent {
public function belongsTo()
{
return $this->belongsTo('Usuario');
}
}
class Pessoa extends Eloquent {
public function hasOne()
{
return $this->hasOne('Usuario');
}
}
Regarding methods and/or properties, you have access to all of the related object (Eloquent) but referring to the Eloquent/Model.
If you want to do something more specific, you should use the concepts/methodologies related to:
- Addiction Injection (DI)
- Ioc
- S.O.L.I.D
For example, working with Repositories (Repositories/Factories), as almost everything is isolated from the basic structure (mvc), you will have for example "n" repositories with the necessary methods/linked to any class, with this you can access them from any "place".
I believe that by researching the above concepts you will get to where you want.
I recommend purchasing a subscription to Laracasts of the amazing Jeffrey Way.
is ratio 1 to 1? you want to ?
– user6026
The relationship I know how to do, but I wish I could use class inheritance ...
– Vagner do Carmo
got it !!!!!!!!!!
– user6026
Look I’d need to test the behavior because there are two models neh by your question !!!
– user6026
the two already inherit from the Eloquent correct that statement? if it is not gives!
– user6026