Added page authorisation and cug processing

This commit is contained in:
Deon George
2018-12-10 22:59:02 +11:00
parent 86e29a3cee
commit 4d65bb05a1
15 changed files with 792 additions and 107 deletions

43
app/User.php Normal file
View 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);
}
}