This repository was archived by the owner on Feb 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed
resources/views/bread/partials Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,17 @@ public function shouldActionDisplayOnDataType()
8181}
8282```
8383
84+ If you want to show your action-button on a per-row-base, simply implement a method ` shouldActionDisplayOnRow($row) ` and add your condition(s)
85+
86+ ``` php
87+ <?php
88+
89+ public function shouldActionDisplayOnRow($row)
90+ {
91+ return $row->id > 10;
92+ }
93+ ```
94+
8495## Mass Actions
8596
8697Mass actions are called for multiple instances of a model.
Original file line number Diff line number Diff line change 55 $action = new $class ($dataType , $data );
66 @endphp
77 @can ($action -> getPolicy (), $data )
8- <a href =" {{ $action -> getRoute ($dataType -> name ) } }" title =" {{ $action -> getTitle () } }" {!! $action -> convertAttributesToHtml () ! !} >
9- <i class =" {{ $action -> getIcon () } }" ></i > <span class =" hidden-xs hidden-sm" >{{ $action -> getTitle () } } </span >
10- </a >
8+ @if ($action -> shouldActionDisplayOnRow ($data ) )
9+ <a href =" {{ $action -> getRoute ($dataType -> name ) } }" title =" {{ $action -> getTitle () } }" {!! $action -> convertAttributesToHtml () ! !} >
10+ <i class =" {{ $action -> getIcon () } }" ></i > <span class =" hidden-xs hidden-sm" >{{ $action -> getTitle () } } </span >
11+ </a >
12+ @endif
1113 @endcan
1214@elseif (method_exists ($action , ' massAction' ) )
1315 <form method =" post" action =" {{ route (' voyager.' . $dataType -> slug . ' .action' ) } }" style =" display :inline " >
Original file line number Diff line number Diff line change @@ -50,4 +50,9 @@ public function shouldActionDisplayOnDataType()
5050 {
5151 return $ this ->dataType ->name === $ this ->getDataType () || $ this ->getDataType () === null ;
5252 }
53+
54+ public function shouldActionDisplayOnRow ($ row )
55+ {
56+ return true ;
57+ }
5358}
You can’t perform that action at this time.
0 commit comments