Download the PHP package dandelionmood/laravel-relatable without Composer

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

NOTE: This package is not registered on Packagist and is abandoned. It's only being use in a few internal projects at Spatie

Trait to Manage an Eloquent Model's Related Content

Latest Version on Packagist Build Status SensioLabsInsight Quality Score Total Downloads

The laravel-relatable package provides a HasRelatedContent trait, which allows you to easily relate models to other models of any type.

Afterwards, you can retrieve the post's related content via the related accessor.

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

Install

You can install the package via composer:

In order to publish the migrations and configuration file, you'll need to register the service provider:

If you want to specify a custom table name, you'll need to publish and edit the configuration file:

Publishing and running the migrations is mandatory:

Usage

After running the migrations, you can start using the package by adding the HasRelatedContent trait to your models.

Adding and Removing Related Content

You can add related content to a model using the relate function. relate expects a model or an ID and type as parameters.

Removing related content happens with the unrelate function, which expects the same parameters.

Synchronizing Related Content

Related content can be synced like Laravel's sync function for many-to-many relationships. The first parameter of syncRelated should be a collection of Eloquent models or an array containing associated arrays with ID's and types.

By default, syncRelated will detach all other related models. If you just want to add related content, set the detach parameter to false.

Retrieving Related Content

The HasRelatetContent trait provides an accessor for related. Related content will be loaded and cached in memory the first time this function is called.

The related content can be manually reloaded via the loadRelated method. This method will refill the related cache, and return the collection.

A hasRelated helper function is also provided.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

About Spatie

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

License

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


All versions of laravel-relatable with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
illuminate/database Version ^5.2
illuminate/support Version ^5.2
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 dandelionmood/laravel-relatable contains the following files

Loading the files please wait ....