Created
December 1, 2017 18:01
-
-
Save jamesratcliffe/4d9e68b37b405917dfc1e77e99b188be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
use LaravelFillableRelations\Eloquent\Concerns\HasFillableRelations; | |
class Tool extends Model | |
{ | |
use HasFillableRelations; | |
protected $fillable = ['name']; | |
protected $fillable_relations = ['fields']; | |
public function fields() | |
{ | |
return $this->hasMany(static::class . 'Field'); | |
} | |
} | |
class ToolField extends Model | |
{ | |
use HasFillableRelations; | |
protected $fillable = ['name']; | |
protected $fillable_relations = ['choices']; | |
public function choices() | |
{ | |
return $this->hasMany(static::class . 'Choice'); | |
} | |
} | |
class ToolFieldChoice extends Model | |
{ | |
protected $fillable = ['name']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment