@@ -114,8 +114,6 @@ class CustomerCouponCrud extends CrudService
114
114
public function __construct ()
115
115
{
116
116
parent ::__construct ();
117
-
118
- Hook::addFilter ( $ this ->namespace . '-crud-actions ' , [ $ this , 'setActions ' ], 10 , 2 );
119
117
}
120
118
121
119
/**
@@ -364,7 +362,7 @@ public function getColumns(): array
364
362
/**
365
363
* Define actions
366
364
*/
367
- public function setActions ( CrudEntry $ entry, $ namespace )
365
+ public function setActions ( CrudEntry $ entry ): CrudEntry
368
366
{
369
367
$ entry ->user_username = $ entry ->user_username ?: __ ( 'N/A ' );
370
368
@@ -379,30 +377,32 @@ public function setActions( CrudEntry $entry, $namespace )
379
377
380
378
$ entry ->coupon_type = $ entry ->coupon_type === 'percentage_discount ' ? __ ( 'Percentage ' ) : __ ( 'Flat ' );
381
379
380
+ // Snippet 1: No changes needed, assuming 'identifier' is already in place
382
381
$ entry ->action (
383
382
label: __ ( 'Usage History ' ),
384
383
type: 'GOTO ' ,
385
384
url: ns ()->url ( '/dashboard/customers/ ' . $ entry ->customer_id . '/coupons/ ' . $ entry ->id . '/history/ ' ),
386
- identifier: 'usage.history '
385
+ identifier: 'usage.history '
387
386
);
388
387
389
- // you can make changes here
390
- $ entry ->addAction ( ' edit ' , [
391
- ' label ' => __ ( 'Edit ' ),
392
- ' namespace ' => ' edit ' ,
393
- ' type ' => 'GOTO ' ,
394
- ' url ' => ns ()->url ( '/dashboard/ ' . $ this ->slug . '/edit/ ' . $ entry ->id ),
395
- ] );
388
+ // Snippet 2: 'namespace' likely needs replacement
389
+ $ entry ->action (
390
+ label: __ ( 'Edit ' ),
391
+ identifier: ' edit ' , // Replace ' namespace' with 'identifier'
392
+ type: 'GOTO ' ,
393
+ url: ns ()->url ( '/dashboard/ ' . $ this ->slug . '/edit/ ' . $ entry ->id )
394
+ );
396
395
397
- $ entry ->addAction ( 'delete ' , [
398
- 'label ' => __ ( 'Delete ' ),
399
- 'namespace ' => 'delete ' ,
400
- 'type ' => 'DELETE ' ,
401
- 'url ' => ns ()->url ( '/api/crud/ns.customers-coupons/ ' . $ entry ->id ),
402
- 'confirm ' => [
396
+ // Snippet 3: 'namespace' likely needs replacement
397
+ $ entry ->action (
398
+ label: __ ( 'Delete ' ),
399
+ identifier: 'delete ' , // Replace 'namespace' with 'identifier'
400
+ type: 'DELETE ' ,
401
+ url: ns ()->url ( '/api/crud/ns.customers-coupons/ ' . $ entry ->id ),
402
+ confirm: [
403
403
'message ' => __ ( 'Would you like to delete this ? ' ),
404
404
],
405
- ] );
405
+ );
406
406
407
407
return $ entry ;
408
408
}
0 commit comments