Added page authorisation and cug processing
This commit is contained in:
21
app/Models/CUG.php
Normal file
21
app/Models/CUG.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CUG extends Model
|
||||
{
|
||||
protected $table = 'cugs';
|
||||
|
||||
public function isMember(CUG $o)
|
||||
{
|
||||
while ($o)
|
||||
{
|
||||
if (! $this->parent_id OR $o->id == $this->parent_id)
|
||||
return TRUE;
|
||||
|
||||
$o = $this::findOrFail($o->parent_id);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user