Skip to content

Commit b12a269

Browse files
committed
add api for option feature
1 parent f2305a7 commit b12a269

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

Services/Components/Actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function get(): mixed
3333
->label($this->label)
3434
->type($this->type)
3535
->icon($this->icon)
36-
->action($this->action)
36+
->action($this->action, $this->actionMethod)
3737
->modal($this->modal)
3838
->confirmed($this->confirmed)
3939
->url($this->url)

Services/Concerns/HasApi.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Modules\Base\Services\Concerns;
4+
5+
trait HasApi
6+
{
7+
/**
8+
* @var ?string
9+
*/
10+
public ?string $apiRow = null;
11+
/**
12+
* @var ?string
13+
*/
14+
public ?string $apiModel = null;
15+
/**
16+
* @var ?string
17+
*/
18+
public ?string $apiLabel = null;
19+
/**
20+
* @var ?string
21+
*/
22+
public ?string $apiQuery = null;
23+
24+
public function api(string | null $apiRow, string | null $apiModel,string | null $apiLabel=null, string | null $apiQuery=null): static
25+
{
26+
$this->apiRow = $apiRow;
27+
$this->apiModel = $apiModel;
28+
$this->apiLabel = $apiLabel;
29+
$this->apiQuery = $apiQuery;
30+
return $this;
31+
}
32+
}

Services/Rows/Abstracts/Base.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Modules\Base\Services\Rows\Abstracts;
44

55
use Modules\Base\Services\Concerns\HasAdd;
6+
use Modules\Base\Services\Concerns\HasApi;
67
use Modules\Base\Services\Concerns\HasColor;
78
use Modules\Base\Services\Concerns\HasDefault;
89
use Modules\Base\Services\Concerns\HasDescription;
@@ -45,6 +46,7 @@ abstract class Base implements Component
4546
use HasName;
4647
use HasLabel;
4748
use HasDefault;
49+
use HasApi;
4850
use HasRoles;
4951
use HasPlaceholder;
5052
use HasHint;
@@ -79,4 +81,4 @@ abstract class Base implements Component
7981
use IsMoney;
8082
use IsSortable;
8183
use IsBadge;
82-
}
84+
}

0 commit comments

Comments
 (0)