PHP code example of lassehaslev / laravel-sortable
1. Go to this page and download the library: Download lassehaslev/laravel-sortable 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/ */
lassehaslev / laravel-sortable example snippets
<?
class TestObject extends Illuminate\Database\Eloquent\Model {
use LasseHaslev\LaravelSortable\Traits\Sortable;
}
<?
class TestObject extends Illuminate\Database\Eloquent\Model {
use LasseHaslev\LaravelSortable\Traits\Sortable;
protected $sortingColumnName = 'order'; // Default
}
// Get sorted list
$sortedCollection = Object::sorted()->all();
// Move object to position
Object::moveTo( $objectToMove, $position );
// Move to front
Object::moveToFront( $objectToMove );
// Move to back
Object::moveToBack( $objectToMove );
// Increment position by one
Object::incrementPosition( $objectToMove );
// Decrement position by one
Object::decrementPosition( $objectToMove );
config/app.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.