예제 #1
0
 public function scopeExceptSubtreeById($q, $v = null)
 {
     if (!$v) {
         return $q;
     } else {
         $subtree = Static::find($v);
         if ($subtree->id) {
             return $q->where($this->getPathField(), 'not like', $subtree->ori_path . '%');
         } else {
             return $q;
         }
     }
 }
예제 #2
0
파일: User.php 프로젝트: sliekasirdis79/POS
 public static function assignRole($id, $type = '')
 {
     $type = $type === '' ? Config::get('role.sales') : $type;
     $staff = Static::find($id);
     $staff->roles()->attach($type);
 }