Download the PHP package optimistdigital/nova-sortable without Composer

On this page you can find all versions of the php package optimistdigital/nova-sortable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

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.
Please rate this library. Is it a good library?

Informations about the package nova-sortable

Nova Sortable

Latest Version on Packagist Total Downloads

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag & drop.

Uses Spatie's eloquent-sortable under the hood.

Requirements

Features

Screenshots

Installation

Install the package in a Laravel Nova project via Composer:

Usage

Create migration

Add an order field to the model using Laravel migrations:

Implement eloquent-sortable

Implement the Spatie's eloquent-sortable interface and apply the trait:

When the model does not have a sortable configuration, the default eloquent-sortable configuration will be used.

Apply HasSortableRows to Nova resource

Apply HasSortableRows trait from this package on the Resource:

NB! This overrides the indexQuery() method.

Disallowing sorting on a per-request/resource basis

You can disable sorting on a per-request or per-resource basis by overriding the canSort() on the Resource method like so:

NB! This requires you to disable caching (see below).

Disabling caching

If you want to disable caching due to using canSort or running tests, you can set sortableCacheEnabled to false on the resource that has the HasSortableRows trait. See the example below:

Or if you want to temporarily disable sortability cache (for tests), you can call Resource::disableSortabilityCache() on the resource.

Custom sortable options

Nova sorting order

To sort your resource in a different order in Nova, you can set the nova_order_by flag to DESC (ASC by default) in the $sortable array.

Ignoring policies

If you have a resource that has authorizedToUpdate false, but you want the user to still be able to sort it, you can use the ignore_policies flag like so:

Sorting on HasMany relationship

NB! The resource can only be sorted on either the Index view or the HasMany list view, but not both!

Sorting on HasMany is simple. Add 'sort_on_has_many' => true to the $sortable array on the model. Like so:

The sort on has many configuration can be apply in a per model basis or it can be added in the eloquent-sortable configuration for all the models.

Sorting on ManyToMany relationships

Sorting on BelongsToMany and MorphToMany relationships is available, but requires special steps.

See the documentation here: Sorting ManyToMany relationships (w/ pivot table).

Localization

The translation file(s) can be published by using the following publish command:

You can add your translations to resources/lang/vendor/nova-sortable/ by creating a new translations file with the locale name (ie et.json) and copying the JSON from the existing en.json.

Other usecases

Using indexQuery

This package overwrites the indexQuery of the Resource and if you still want to use it, you can do it as follows:

Credits

License

Nova Sortable is open-sourced software licensed under the MIT license.


All versions of nova-sortable with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
spatie/eloquent-sortable Version ^3.10.0|^4.0
laravel/nova Version ^4.24.0
outl1ne/nova-translations-loader Version ^5.0
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 optimistdigital/nova-sortable contains the following files

Loading the files please wait ....