Skip to content

Instantly share code, notes, and snippets.

@adbrsln
Created October 13, 2018 02:52
Show Gist options
  • Save adbrsln/fc6edb1374512c067728fc116173d8af to your computer and use it in GitHub Desktop.
Save adbrsln/fc6edb1374512c067728fc116173d8af to your computer and use it in GitHub Desktop.
User.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'email',
'password',
'username',
'nric',
'mobile_no',
'office_phone_no',
'address',
'postal_code',
'user_status',
'state_id',
'role_id'
];
public function states_val(){ //states daerah
return $this->belongsTo('App\State', 'state_id');
}
public function roles(){
return $this->belongsToMany('App\Role');
}
public function companies(){
return $this->belongsToMany('App\Company');
}
public function credits(){
return $this->belongsToMany('App\Credit');
}
protected $hidden = [
'password', 'remember_token',
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment