Download the PHP package blasttech/eloquent-related-plus without Composer

On this page you can find all versions of the php package blasttech/eloquent-related-plus. 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 eloquent-related-plus

Add extra search and order functionality to Laravel Eloquent models.

Latest Version Build Status StyleCI Quality Score Total Downloads

This package provides a trait that adds extra ways to order and search complex models. With Eloquent, when relations are used (eg. HasOne, HasMany, BelongsTo) the primary model can't be sorted using a field in a related table.

For example, you might have a list of Customers with a one-to-one relation (HasOne) to a Contacts model for the Customer contact.

If you had a table of customers and wanted to sort it by Contact name, you nomrally wouldn't be able to in Laravel using the relation above, but you could with this package.

Installation

This package can be installed through Composer.

Usage

To add complex order and search behaviour to your model you must:

  1. specify that the model will conform to
  2. use the trait

Using the earlier example:

modelJoin

Use this scope to add a join for a related model.

Example

This will add a left join to the Contacts model using the Contacts() relation, using 'where' instead of 'on' and include all the fields from the model in the select.

$relation_name

The name of the relation. Only BelongsTo, HasOne, HasMany or HasOneOrMany relations will work.

$operator

The operator used to join the related table. This will default to '=' but any of the standard Laravel join operators can be used.

$type

The type of join. This will default to 'left' but any of the standard Laravel join types are allowed.

$where

The method of joining the table. The default (false) uses an 'on' statement but if true, a where statement is used.

$related_select

The $related_select option determines if the fields in the joined table will be included in the query. If true, the field names will be in the format '_table_name.columnname', for example, '_customer.contactname' with the table name and period (.) included in the field name. This is to allow fields from joined tables to be used when they have the same column names.

orderByCustom

Example

This will add a left join to the Contacts model using the Contacts() relation and then sort it by the contact_name.

search

Example

This will add a left join to the Contacts model using the Contacts() relation, and search for $contact_name.

License

The MIT License (MIT). Please see License File for more information.

Credits

The example shown in http://laravel-tricks.com/tricks/automatic-join-on-eloquent-models-with-relations-setup was used as a basis for the modelJoin and relationJoin scopes.


All versions of eloquent-related-plus with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
illuminate/database Version ~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8|~6.0|~7.0|~8.0
illuminate/support Version ~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8|~6.0|~7.0|~8.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 blasttech/eloquent-related-plus contains the following files

Loading the files please wait ....