hasMany("\App\Models\PermissionMenuModel","parent_id","id") ->with("children"); } protected function getHasLinkAttribute () { return $this->url?true:false; } public function getMenuDetailArrayAttribute () { try { return json_decode ( $this->menu_detail, true ); } catch ( Exception $e ) { return []; } } public function getUrlAttribute ( ) { try { return $this->menuDetailArray[ "url" ]; } catch ( Exception $e ) { return null; } } public function getComponentAttribute ( ) { try { return $this->menuDetailArray[ "component" ]; } catch ( Exception $e ) { return null; } } }