Advertisement
Guest User

Untitled

a guest
Jun 7th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. class User extends Authenticatable
  2. {
  3.     public function address () {
  4.         $this->hasOne(App\Address::class);
  5.     }
  6.  
  7.     public function test()
  8.     {
  9.         return $this->hasMany(App\Test::class);
  10.     }
  11. }
  12.  
  13. class Test extends Model
  14. {
  15.     public function user()
  16.     {
  17.         return $this->belongsTo(\App\User::class);
  18.     }
  19.  
  20.     public function category()
  21.     {
  22.         return $this->hasOne(\App\Category::class);
  23.     }
  24.  
  25.     public function question()
  26.     {
  27.         return $this->hasMany(\App\Question::class);
  28.     }
  29. }
  30.  
  31. class Question extends Model
  32. {
  33.     public function test()
  34.     {
  35.         return $this->belongsTo(App\Test::class);
  36.     }
  37.  
  38.     public function answer()
  39.     {
  40.         return $this->hasMany(App\Answer::class);
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement