<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Func extends Model
{
    //
    public $timestamps = false;
    protected $guarded = ['id'];
    
    public function permissions() {
        return $this->hasMany("App\Models\GroupPermission");
    }

    public function child() {
        return \App\Models\Func::whereParentId($this->id)->orderBy('sort')->get();
    }
    public function childary() {
        $ary = [];
        foreach( \App\Models\Func::whereParentId($this->id)->orderBy('sort')->get() as $v) {
            $ary[] = $v->slug;
        }

        return $ary;   
    }
}
