PHP code example of azhida / laravel-tools

1. Go to this page and download the library: Download azhida/laravel-tools library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

azhida / laravel-tools example snippets

shell
$ php artisan vendor:publish
# 选择 Azhida\LaravelTools\ServiceProvider
shell
$ php artisan migrate --path=database/migrations/2021_08_31_091229_create_test_binary_trees_table.php
$ php artisan migrate --path=database/migrations/2021_08_31_092504_create_test_binary_tree_max_depths_table.php

// 获取ID节点下可添加的点位 -- 自上而下,从左到右
TestBinaryTree::searchAddEnableNodeById_DepthAsc_LToR($id);

// 获取ID节点下可添加的点位 -- 左腿【右腿】最底部
TestBinaryTree::searchAddEnableNodeById_Leg_MaxDepth($id, $leg = 'L');

// 获取ID的所有上级
TestBinaryTree::getParentsById($id);

// 获取ID所有子节点
TestBinaryTree::getSonsById($id, $depth = 10);

// 判断 A、D 两个节点是否存在祖孙关系
TestBinaryTree::isAncestor_AD($ancestor_id, $descendant_id);