File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Illuminate \Support \Arr ;
6
6
use Illuminate \Support \Fluent ;
7
+ use Illuminate \Support \Str ;
8
+ use Illuminate \Support \Traits \Macroable ;
7
9
use Yajra \DataTables \Html \Editor \Fields \Field ;
8
10
use Yajra \DataTables \Html \HasAuthorizations ;
9
11
use Yajra \DataTables \Utilities \Helper ;
22
24
class Editor extends Fluent
23
25
{
24
26
use HasAuthorizations;
25
- use HasEvents;
27
+ use HasEvents, Macroable {
28
+ Macroable::__call as macroCall;
29
+ }
26
30
27
31
final public const DISPLAY_LIGHTBOX = 'lightbox ' ;
28
32
@@ -314,4 +318,21 @@ public function hiddenOnEdit(array $fields): static
314
318
{
315
319
return $ this ->hiddenOn ('edit ' , $ fields );
316
320
}
321
+
322
+ public function __call ($ method , $ parameters ): static
323
+ {
324
+ if (Str::startsWith ($ method , 'on ' )) {
325
+ $ event = Str::camel (substr ($ method , 2 , strlen ($ method ) - 2 ));
326
+
327
+ return $ this ->on ($ event , $ parameters [0 ]);
328
+ }
329
+
330
+ $ macroCall = $ this ->macroCall ($ method , $ parameters );
331
+
332
+ if (! $ macroCall instanceof Editor) {
333
+ abort (500 , sprintf ('Method %s::%s must return an Editor instance. ' , static ::class, $ method ));
334
+ }
335
+
336
+ return $ this ;
337
+ }
317
338
}
You can’t perform that action at this time.
0 commit comments