Skip to content
This repository has been archived by the owner on Jun 6, 2019. It is now read-only.

donnysim/ethereal-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ethereal Laravel

This package extends and changes some laravel functionalities.

Minimum required laravel version is 5.4.

Model

This package provides extended laravel Model, named Ethereal. This model works a bit different in few use cases:

  • fillable and guarded functionality is disabled

It's the only reasonable way to work with Eloquent and prevents the use of request()->all(). This also improves code readability where you don't have to guess what request data you'll receive as you'll have to specify it if you're going to fill it to the model.

  • columns model field is available

This field is used to get dirty columns for model save or update, so you can have as many custom attributes in there as you want. If the column is empty (default), all attributes are held as possible table columns.

  • models have validation

Methods like valid and validOrFail are provided to validate the model. fullyValid is present if you want to validate the model and all it's relations. This uses laravel's validator so after any validation action you can call validator to get the last used validator. Model validation rules are determined by validationRules method - sometimes rules change depending on model existence, to determine model existence you can use $this->exists model field.

  • relationships model field is available

relationships field can be used to write all relations that can be auto filled by fill method. In addition, extendedRelations property is available and enabled by default to provide automatic relation packing - you can pass array and it will be converted into model or collection depending on relation type. Otherwise setRelation can be used to achieve the same behavior.

Note: unsupported relation types or values will be added as is. Added models and collection with models will only be checked for type validity, array elements in collection will not be converted into models.

About

Play around package for laravel.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages