<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
joaoroyosilva / eloquent-nested-attributes example snippets
php
namespace App;
use Eloquent\NestedAttributes\Model;
class Post extends Model
{
protected $fillable = ['title'];
protected $nested = ['option', 'comments'];
public function option() {
//it can be also morphOne
return $this->hasOne('App\Option');
}
public function comments() {
//it can be also morphMany
return $this->hasMany('App\Comment');
}
}