Skip to content

Commit

Permalink
Nesting testing
Browse files Browse the repository at this point in the history
  • Loading branch information
daftspunk committed Mar 4, 2022
1 parent f4dc7b8 commit da7752c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
11 changes: 11 additions & 0 deletions config/repeater_country_brothers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ gallery:
mode: image
imageWidth: 200
imageHeight: 200

sister:
name: Sister
icon: icon-refresh
fields:
sisters:
label: Sister
prompt: Add sister
span: full
type: repeater
form: $/october/test/config/repeater_country_sisters.yaml
6 changes: 6 additions & 0 deletions config/repeater_country_sisters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ fields:
subtitle:
label: Suburb
span: full
photos:
label: Photos
type: fileupload
mode: image
imageWidth: 200
imageHeight: 200
4 changes: 2 additions & 2 deletions models/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Country extends Model
public $table = 'october_test_countries';

/**
* @var array Guarded fields
* @var array guarded fields
*/
protected $guarded = [];

Expand All @@ -30,7 +30,7 @@ class Country extends Model
protected $fillable = [];

/**
* @var array Jsonable fields
* @var array jsonable fields
*/
protected $jsonable = ['pages', 'states', 'locations', 'content', 'notes'];

Expand Down
11 changes: 11 additions & 0 deletions models/CountryBrother.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,15 @@ class CountryBrother extends Model
public $attachMany = [
'photos' => \System\Models\File::class,
];

/**
* @var array hasMany
*/
public $hasMany = [
'sisters' => [
RepeaterItem::class,
'key' => 'parent_id',
'delete' => true
],
];
}
7 changes: 7 additions & 0 deletions models/RepeaterItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ class RepeaterItem extends Model
*/
protected $fieldValues = [];

/**
* @var array attachMany
*/
public $attachMany = [
'photos' => \System\Models\File::class,
];

/**
* afterFetch
*/
Expand Down

0 comments on commit da7752c

Please sign in to comment.