Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. class Regione extends Model
  2. {
  3.     protected $table = 'regioni';
  4.  
  5.     public function province()
  6.     {
  7.         return $this->hasMany('App\Provincia');
  8.     }
  9. }
  10.  
  11. class Provincia extends Model
  12. {
  13.     protected $table = 'province';
  14.  
  15.     public function regione()
  16.     {
  17.         return $this->belongsTo('App\Regione');
  18.     }
  19.  
  20.     public function dipendenti()
  21.     {
  22.         return $this->hasMany('App\Dipendente');
  23.     }
  24. }
  25.  
  26. class Dipendente extends Model
  27. {
  28.     protected $table = 'dipendenti';
  29.  
  30.     public function province()
  31.     {
  32.         return $this->belongsToMany('App\Provincia');
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement