Advertisement
a6a51

User Model

Jun 17th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Models;
  4.  
  5. use Illuminate\Notifications\Notifiable;
  6. use Illuminate\Foundation\Auth\User as Authenticatable;
  7.  
  8. class User extends Authenticatable
  9. {
  10.     use Notifiable;
  11.  
  12.     /**
  13.      * The attributes that are mass assignable.
  14.      *
  15.      * @var array
  16.      */
  17.     protected $fillable = [
  18.         'name', 'email', 'password', 'phone', 'province_id', 'regency_id', 'district_id', 'village_id', 'description'
  19.     ];
  20.  
  21.     /**
  22.      * The attributes that should be hidden for arrays.
  23.      *
  24.      * @var array
  25.      */
  26.     protected $hidden = [
  27.         'password'
  28.     ];
  29.  
  30.     public function province()
  31.     {
  32.         return $this->belongsTo('App\Models\Province');
  33.     }
  34.  
  35.     public function regency()
  36.     {
  37.         return $this->belongsTo('App\Models\Regency');
  38.     }
  39.  
  40.     public function district()
  41.     {
  42.         return $this->belongsTo('App\Models\District');
  43.     }
  44.  
  45.     public function village()
  46.     {
  47.         return $this->belongsTo('App\Models\Village');
  48.     }
  49.  
  50.     public function comments()
  51.     {
  52.         return $this->hasMany('App\Models\Comment');
  53.     }
  54.  
  55.     public function subcomments()
  56.     {
  57.         return $this->hasMany('App\Models\SubComment');
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement