File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,13 @@ class Actions extends AbstractDisplayer
2828 */
2929 protected $ resource ;
3030
31+ /**
32+ * Disable all actions.
33+ *
34+ * @var bool
35+ */
36+ protected $ disableAll = false ;
37+
3138 /**
3239 * Append a action.
3340 *
@@ -114,6 +121,18 @@ public function disableEdit(bool $disable = true)
114121 return $ this ;
115122 }
116123
124+ /**
125+ * Disable all actions.
126+ *
127+ * @return $this
128+ */
129+ public function disableAll ()
130+ {
131+ $ this ->disableAll = true ;
132+
133+ return $ this ;
134+ }
135+
117136 /**
118137 * Set resource of current resource.
119138 *
@@ -147,6 +166,10 @@ public function display($callback = null)
147166 $ callback ->call ($ this , $ this );
148167 }
149168
169+ if ($ this ->disableAll ) {
170+ return '' ;
171+ }
172+
150173 $ actions = $ this ->prepends ;
151174
152175 foreach ($ this ->actions as $ action ) {
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ public function disableEdit(bool $disable = true)
155155 /**
156156 * @param null|\Closure $callback
157157 *
158- * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
158+ * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|string
159159 */
160160 public function display ($ callback = null )
161161 {
@@ -165,6 +165,10 @@ public function display($callback = null)
165165 $ callback ->call ($ this , $ this );
166166 }
167167
168+ if ($ this ->disableAll ) {
169+ return '' ;
170+ }
171+
168172 $ this ->prependDefaultActions ();
169173
170174 $ actions = [
You can’t perform that action at this time.
0 commit comments