PHP code example of erikgall / listify

1. Go to this page and download the library: Download erikgall/listify 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/ */

    

erikgall / listify example snippets


php artisan listify:attach {table_name} {position_column_name}

php artisan migrate



use EGALL\Listify\Listify;

class User extends Eloquent
{
    use Listify;

    ...
}


use EGALL\Listify\Listify;

class User extends Eloquent
{
    use Listify;

    public function __construct(array $attributes = []) {

        parent::__construct($attributes);

        $this->listifyConfig->setScope('answer_to_ltuae = 42');
    }
}



use EGALL\Listify\Listify;

class ToDoListItem extends Eloquent
{
    use Listify;

    public function __construct(array $attributes = []) {

        parent::__construct($attributes);

        $this->listifyConfig->setScope($this->toDoList());
    }

    public function toDoList()
    {
        $this->belongsTo('ToDoList');
    }
}



class ToDoListItem extends Eloquent
{
    use \EGALL\Listify\Listify;

    public function __construct(array $attributes = []) {

        parent::__construct($attributes);

        $this->listifyConfig->setScope(DB::table($this->getTable())->where('type', '=', 'Not A List of My Favorite Porn Videos'));
    }
}

$this->listifyConfig->setScope('what_does_the_fox_say = "ring ding ding ding"');

$this->listifyConfig->setTopPositionInList(0)
    ->setPositionColumnName('order')
    ->setScope($this->menu())
    ->setAddNewItemTo(Config::POSITION_BOTTOM);