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()
81
81
}
82
82
```
83
83
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
+
84
95
## Mass Actions
85
96
86
97
Mass actions are called for multiple instances of a model.
Original file line number Diff line number Diff line change 5
5
$action = new $class ($dataType , $data );
6
6
@endphp
7
7
@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
11
13
@endcan
12
14
@elseif (method_exists ($action , ' massAction' ) )
13
15
<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()
50
50
{
51
51
return $ this ->dataType ->name === $ this ->getDataType () || $ this ->getDataType () === null ;
52
52
}
53
+
54
+ public function shouldActionDisplayOnRow ($ row )
55
+ {
56
+ return true ;
57
+ }
53
58
}
You can’t perform that action at this time.
0 commit comments