3
3
namespace Yassi \NestedForm ;
4
4
5
5
use function GuzzleHttp \json_encode ;
6
- use Illuminate \Support \Facades \Route ;
7
6
use Illuminate \Support \Str ;
8
7
use Illuminate \Validation \ValidationException ;
8
+ use Laravel \Nova \Contracts \RelatableField ;
9
9
use Laravel \Nova \Fields \BelongsTo ;
10
10
use Laravel \Nova \Fields \BelongsToMany ;
11
11
use Laravel \Nova \Fields \Field ;
24
24
25
25
use Laravel \Nova \Panel ;
26
26
27
- class NestedForm extends Field
27
+ class NestedForm extends Field implements RelatableField
28
28
{
29
29
30
30
/**
31
31
* Wrap left.
32
- *
32
+ *
33
33
* @var string
34
34
*/
35
35
const WRAP_LEFT = '{{ ' ;
36
36
37
37
/**
38
38
* Wrap right.
39
- *
39
+ *
40
40
* @var string
41
41
*/
42
42
const WRAP_RIGHT = '}} ' ;
43
43
44
44
/**
45
45
* INDEX.
46
- *
46
+ *
47
47
* @var string
48
48
*/
49
49
const INDEX = 'INDEX ' ;
50
50
51
51
/**
52
52
* ID.
53
- *
53
+ *
54
54
* @var string
55
55
*/
56
56
const ID = 'ID ' ;
@@ -78,85 +78,85 @@ class NestedForm extends Field
78
78
79
79
/**
80
80
* The field's relationship resource class.
81
- *
81
+ *
82
82
* @var string
83
83
*/
84
84
public $ resourceClass ;
85
85
86
86
/**
87
87
* The field's relationship resource name.
88
- *
88
+ *
89
89
* @var string
90
90
*/
91
91
public $ resourceName ;
92
92
93
93
/**
94
94
* The field's relationship name.
95
- *
95
+ *
96
96
* @var string
97
97
*/
98
98
public $ viaRelationship ;
99
99
100
100
/**
101
101
* The field's singular label.
102
- *
102
+ *
103
103
* @var string
104
104
*/
105
105
public $ singularLabel ;
106
106
107
107
/**
108
108
* The field's plural label.
109
- *
109
+ *
110
110
* @var string
111
111
*/
112
112
public $ pluralLabel ;
113
113
114
114
/**
115
115
* Default separator.
116
- *
116
+ *
117
117
* @var string
118
118
*/
119
119
public $ separator = '. ' ;
120
120
121
121
/**
122
122
* From resource uriKey.
123
- *
123
+ *
124
124
* @var string
125
125
*/
126
126
public $ viaResource ;
127
127
128
128
/**
129
129
* Key name.
130
- *
130
+ *
131
131
* @var string
132
132
*/
133
133
public $ keyName ;
134
134
135
135
136
136
/**
137
137
* Whether the form should be opened by default.
138
- *
138
+ *
139
139
* @var boolean
140
140
*/
141
141
public $ opened = true ;
142
142
143
143
/**
144
144
* The heading template for children.
145
- *
145
+ *
146
146
* @var string
147
147
*/
148
148
public $ heading ;
149
149
150
150
/**
151
151
* The maximum number of children.
152
- *
152
+ *
153
153
* @var int
154
154
*/
155
155
public $ max = 0 ;
156
156
157
157
/**
158
158
* The minimum number of children.
159
- *
159
+ *
160
160
* @var int
161
161
*/
162
162
public $ min = 0 ;
@@ -168,7 +168,7 @@ class NestedForm extends Field
168
168
169
169
/**
170
170
* Return context
171
- *
171
+ *
172
172
* @var Panel|Field|NestedForm
173
173
*/
174
174
protected $ returnContext ;
@@ -244,7 +244,7 @@ public function children($resource)
244
244
245
245
/**
246
246
* Set the heading.
247
- *
247
+ *
248
248
* @param string $heading
249
249
*/
250
250
public function heading (string $ heading )
@@ -256,7 +256,7 @@ public function heading(string $heading)
256
256
257
257
/**
258
258
* Set whether the form should be opened by default.
259
- *
259
+ *
260
260
* @param boolean $opened
261
261
*/
262
262
public function open (bool $ opened )
@@ -268,7 +268,7 @@ public function open(bool $opened)
268
268
269
269
/**
270
270
* Set the default separator.
271
- *
271
+ *
272
272
* @param string $separator
273
273
*/
274
274
public function separator (string $ separator )
@@ -555,7 +555,7 @@ public static function make(...$arguments)
555
555
/**
556
556
* Wrap an attribute into a dynamic attribute
557
557
* value.
558
- *
558
+ *
559
559
* @param string $attribute
560
560
* @param string $default
561
561
*/
@@ -565,9 +565,9 @@ public static function wrapAttribute(string $attribute, $default = '')
565
565
}
566
566
567
567
/**
568
- * Turn a given attribute string into
568
+ * Turn a given attribute string into
569
569
* a conditional attribute.
570
- *
570
+ *
571
571
* @param string $attribute
572
572
*/
573
573
public static function conditional (string $ attribute )
0 commit comments