-
Notifications
You must be signed in to change notification settings - Fork 1
HasAutoHydration
Kevin Upton edited this page Nov 30, 2017
·
1 revision
HasAutoHydration allows for the model to be automatically filled with the request inputs.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Kevupton\Ethereal\Traits\HasAutoHydration;
class Example extends Model
{
use HasAutoHydration;
}
So that if I post that data:
{
"name": "tester",
"description": "hello"
}
The Example
model will be automatically filled with the attributes name
and description
on create. Allowing me to simply go:
Example::create();