Download the PHP package axn/laravel-database-extension without Composer

On this page you can find all versions of the php package axn/laravel-database-extension. 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 laravel-database-extension

Laravel Database Extension

Includes some extensions/improvements to the Database section of Laravel Framework

Installation

With Composer:

Usage

Natural sorting

Method orderByNatural has been added to QueryBuilder (macro) for natural sorting (see: http://kumaresan-drupal.blogspot.fr/2012/09/natural-sorting-in-mysql-or.html). Use it like orderBy.

Example:

Default order

Add the global scope DefaultOrderScope to the model if you want to have select results automatically sorted:

option can be:

If you don't precise option, it will be "asc" by default.

Example:

If you don't want the default order applied, simply use the Eloquent method withoutGlobalScope() on the model:

Note that the default order is automatically disabled if you manually set ORDER BY clause.

Joins using relationships

This is the most important feature of this package: you can do joins using Eloquent relationships!

WARNING: only BelongsTo, HasOne, HasMany, MorphOne and MorphMany relations are supported. So, if you want to use BelongsToMany, you have to go with the HasMany/BelongsTo relations to/from the pivot table.

Example:

You may also want to use:

Or if the model uses SoftDeletes and you want to include trashed records:

And to add extra criteria:

Note that extra criteria are automatically added if they are defined on the relation:

WARNING: an instance of JoinRelBuilder is created and attached to the Eloquent Builder instance via WeakMap to handle this feature. If you ever clone the Builder instance, note that there is no cloning of the attached JoinRelBuilder instance. This can be a problem if you use "joinRel" on the cloned instance with a reference to an alias created in the original instance.

For example:

If you need to handle this case, use the "cloneWithJoinRelBuilder" method instead of clone:

Eloquent whereHasIn macro

If you have performance issues with the whereHas method, you can use whereHasIn instead.

It uses in clause instead of exists to check existence:

You can use a callback to add extra criteria:

Note that it does not support "dot" notation, but you can use joins:

You may also want to use:

Eloquent whereLike macro

Source: https://murze.be/searching-models-using-a-where-like-query-in-laravel

Warning! This only works on instances of the Eloquent Builder, not on the generic Query Builder.

A replacement of this:

By that:

Or more advanced, a replacement of this:

By that:

SoftDeletes withoutTrashedExcept scope

Our SoftDeletes trait extends the Eloquent one to provide the withoutTrashedExcept scope :

To use it, add the trait Axn\Illuminate\Database\Eloquent\SoftDeletes to models:


All versions of laravel-database-extension with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^10.0 || ^11.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 axn/laravel-database-extension contains the following files

Loading the files please wait ....