PHPackages                             meunik/laravel-edit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. meunik/laravel-edit

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

meunik/laravel-edit
===================

Automates table editing based on request format

2.1.0(2y ago)054MITPHPPHP &gt;=5.6

Since May 6Pushed 1w ago1 watchersCompare

[ Source](https://github.com/meunik/laravel-edit)[ Packagist](https://packagist.org/packages/meunik/laravel-edit)[ RSS](/packages/meunik-laravel-edit/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

Edit by request for Laravel
---------------------------

[](#edit-by-request-for-laravel)

### Laravel wrapper for [Edit table by request format](https://github.com/meunik/laravel-edit)

[](#laravel-wrapper-for-edit-table-by-request-format)

Automates editing based on request formatting.

Editing an establishment's table, request example.

```
{
    "id": 1,
    "name": "Example Establishment Name",
    "telephone": [
        {
            "id": 1,
            "number": "(00) 00000-0000",
        },
        {
            "id": 2,
            "numero": "(00) 00000-0000",
        }
    ],
    "Address": {
        "id": 1,
        "zip": "00000-000",
        "address": "Example Establishment Street",
        "number": 653,
        "complement": "nd",
        "neighborhood": "Example Neighborhood",
        "city": "Example City",
        "state": "Example State"
    }
}
```

First you must inform the Model of the table `TableModel::edit($request)` which is the starting point, in the case of the above json it is `Establishment::class`, then it will be read key by key, if the value of one of these keys is an object, or an array, or an array of objects, the key will initially be considered with a table relationship, then this same key will be validated using [laravel's own Eloquent](https://laravel.com/docs/eloquent-relationships).

> Supports `$appends`, but the `$appends` compulsorily have the same name as the column in the table

Installation
------------

[](#installation)

### Only Laravel

[](#only-laravel)

Require this package in your composer.json and update composer. This will download the package and the laravel-edit e Carbon libraries also.

```
composer require meunik/laravel-edit

```

Using
-----

[](#using)

First you must add the trait `HasEdit` to the `use` of your Model.

```
