<?php namespace Place_user\Api;
use Dever;
class Profit
{
    public function get()
    {
        return Dever::load('common', 'manage')->cascader(2, function($level, $parent) {
            $data = array();
            if ($level == 1) {
                $data = array
                (
                    array('id' => 1, 'name' => '资源'),
                    array('id' => 2, 'name' => '角色'),
                );
            } elseif ($level == 2) {
                if ($parent == 1) {
                    $data = Dever::db('channel', 'place_source')->select([]);
                } elseif ($parent == 2) {
                    $data = Dever::db('role', 'place_user')->select([]);
                }
            }
            return $data;
        });
    }
}
