PHP code example of paxha / laravel-adjacency-list
1. Go to this page and download the library: Download paxha/laravel-adjacency-list 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/ */
paxha / laravel-adjacency-list example snippets
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('parent_id')->nullable();
});
class User extends Model
{
use \Paxha\LaravelAdjacencyList\Eloquent\HasRecursiveRelationships;
}
class User extends Model
{
use \Paxha\LaravelAdjacencyList\Eloquent\HasRecursiveRelationships;
public function getParentKeyName()
{
return 'parent_id';
}
}
class User extends Model
{
use \Paxha\LaravelAdjacencyList\Eloquent\HasRecursiveRelationships;
public function getPathName()
{
return 'path';
}
public function getPathSeparator()
{
return '.';
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.