Download the PHP package sigep/eloquent-enhancements without Composer

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

Eloquent Enhancements

Build Status Scrutinizer Code Quality

This package aims to provide extra functionalities to Laravel's Eloquent. The functionalities, for now, are provided in form of traits, so you don't have to change your models structure.

Error

This trait add two methods to your models.

setErrors

Receives a MessageBag and set in $errors property. The SaveAll uses it to store errors and allow you to use them in your controllers or views.

errors

Returns errors setted by setErrors(). Create a empty MessageBag if errors is not defined.

SaveAll

This tait add the ability to save related objects in just one call. For example, if you have a User model who is related to Phone model, in a hasMany relationship, you can save a user with many phones with just one method call.

Consider the following models:

We strongly suggest that you use model's observers to validate your data and use the setErrors() to transport validation messages. Is the best way to validate related data when you use this trait.

You can create a user with two phones using the createAll() method.

Note that we have a key with the name of the relationship that we create on User model. This is necessary so SaveAll knows which model are involved and how save your data. If everything is fine, createAll will return true. Else, will return false.

Now, if you need to edit a number using the User model (when you have a form that shows all data, for example), you can use the saveAll() method.

See that we add the id from the number on the array. This is necessary so SaveAll knows that is not a new record, but an update.

You do something similar when you need to remove a related model. You just need to pass the _delete key:

In this case, the phone #1 will be removed. The other properties are not necessary, just the id and the _delete key.

SaveAll can handle BelongsToMany relationships to. You just have to use like the examples above. But that kind of relationship has one particularity. If the pivot table has more columns them just the foreign keys, you can create a Relationship Model to handle the validations (assuming that you are using model observers to do the validation like suggested before :) ).

More examples soon.

--

Written with StackEdit.


All versions of eloquent-enhancements with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
illuminate/database Version ~5.4
illuminate/support Version ~5.4
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 sigep/eloquent-enhancements contains the following files

Loading the files please wait ....