File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 44
55use Illuminate \Support \Arr ;
66use Illuminate \Support \Fluent ;
7+ use Illuminate \Support \Str ;
8+ use Illuminate \Support \Traits \Macroable ;
79use Yajra \DataTables \Html \Editor \Fields \Field ;
810use Yajra \DataTables \Html \HasAuthorizations ;
911use Yajra \DataTables \Utilities \Helper ;
2224class Editor extends Fluent
2325{
2426 use HasAuthorizations;
25- use HasEvents;
27+ use HasEvents, Macroable {
28+ Macroable::__call as macroCall;
29+ }
2630
2731 final public const DISPLAY_LIGHTBOX = 'lightbox ' ;
2832
@@ -314,4 +318,15 @@ public function hiddenOnEdit(array $fields): static
314318 {
315319 return $ this ->hiddenOn ('edit ' , $ fields );
316320 }
321+
322+ public function __call ($ method , $ parameters ): mixed
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+ return $ this ->macroCall ($ method , $ parameters );
331+ }
317332}
You can’t perform that action at this time.
0 commit comments