Download the PHP
package nh/sortable without Composer
On this page you can find all versions of the php package
nh/sortable. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor nh Package sortable Short Description Make a Laravel model sortable. License
MIT
FAQ
After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.
Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.
In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories.
In this case some credentials are needed to access such packages.
Please use the auth.json textarea to insert credentials, if a package is coming from a private repository.
You can look here for more information.
Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
To use Composer is sometimes complicated. Especially for beginners.
Composer needs much resources. Sometimes they are not available on a simple webspace.
If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
To make a model with position, you can create a migration via the console commande:
Then, add the Sortable trait to your model:
The default sortable values are position by asc. The trait will add the position column to your $fillable array
In option you can fire an event on the 'parent' model.
Exemple if you sort the Media model in a Page model
In option you can also update the timestamps or not (updated_at)
By default it set to true
Javascript & View
Add in your package.json the dependency:
And add in your JS file the Sortable script:
Initialize the Sortable in your JS file.
Then in your view, add the element:
On the parent, add the attribute data-sortable-model
On the parent, add the attribute data-sortable-order if you need to specify the order to rearanged
On the children, add the attribute data-id
On the children, add an element with class .drag
Get collection by position
You can get your model collection by the position:
You can pass the direction asc or desc
Get collection by sortable
You can get your model collection by the sortable customer or default:
The values of your $sortable array will be take as default
Events
You can use the SortableEvent for dispatch events that happen where sorted happend.
You can pass a name, the model, and the number of model affected
Composer command for our command line client (download client)This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free.Standard composer command
The package nh/sortable contains the following files
Loading the files please wait ....
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.