Added page authorisation and cug processing
This commit is contained in:
43
app/User.php
Normal file
43
app/User.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user