43 lines
795 B
PHP
43 lines
795 B
PHP
|
<?php
|
||
|
|
||
|
namespace App;
|
||
|
|
||
|
use Illuminate\Notifications\Notifiable;
|
||
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||
|
|
||
|
use App\Models\CUG;
|
||
|
|
||
|
class User extends Authenticatable
|
||
|
{
|
||
|
use Notifiable;
|
||
|
|
||
|
/**
|
||
|
* The attributes that are mass assignable.
|
||
|
*
|
||
|
* @var array
|
||
|
*/
|
||
|
protected $fillable = [
|
||
|
'name', 'email', 'password',
|
||
|
];
|
||
|
|
||
|
/**
|
||
|
* The attributes that should be hidden for arrays.
|
||
|
*
|
||
|
* @var array
|
||
|
*/
|
||
|
protected $hidden = [
|
||
|
'password',
|
||
|
];
|
||
|
|
||
|
public function cugs()
|
||
|
{
|
||
|
return $this->belongsToMany(Models\CUG::class,'cug_users','user_id','cug_id');
|
||
|
}
|
||
|
|
||
|
public function isMemberCUG(CUG $o)
|
||
|
{
|
||
|
// @todo This doesnt include parent CUGs
|
||
|
return $this->cugs->contains($o);
|
||
|
}
|
||
|
}
|