Skip to content

Commit 75b28bc

Browse files
authored
Merge pull request #94 from yajra/patch1
fix: editor events TModel
2 parents a4c654d + c924a62 commit 75b28bc

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

src/Concerns/WithCreateAction.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Illuminate\Http\JsonResponse;
99
use Illuminate\Http\Request;
1010

11+
/**
12+
* @template TModel of Model
13+
*/
1114
trait WithCreateAction
1215
{
1316
/**
@@ -80,11 +83,18 @@ protected function createMessages(): array
8083
return [];
8184
}
8285

86+
/**
87+
* @param TModel $model
88+
*/
8389
public function creating(Model $model, array $data): array
8490
{
8591
return $data;
8692
}
8793

94+
/**
95+
* @param TModel $model
96+
* @return TModel
97+
*/
8898
public function created(Model $model, array $data): Model
8999
{
90100
return $model;

src/Concerns/WithEditAction.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Illuminate\Http\JsonResponse;
99
use Illuminate\Http\Request;
1010

11+
/**
12+
* @template TModel of Model
13+
*/
1114
trait WithEditAction
1215
{
1316
/**
@@ -81,11 +84,18 @@ protected function editMessages(): array
8184
return [];
8285
}
8386

87+
/**
88+
* @param TModel $model
89+
*/
8490
public function updating(Model $model, array $data): array
8591
{
8692
return $data;
8793
}
8894

95+
/**
96+
* @param TModel $model
97+
* @return TModel
98+
*/
8999
public function updated(Model $model, array $data): Model
90100
{
91101
return $model;

src/Concerns/WithRemoveAction.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Illuminate\Http\JsonResponse;
1010
use Illuminate\Http\Request;
1111

12+
/**
13+
* @template TModel of Model
14+
*/
1215
trait WithRemoveAction
1316
{
1417
/**
@@ -83,11 +86,18 @@ protected function removeMessages(): array
8386
return [];
8487
}
8588

89+
/**
90+
* @param TModel $model
91+
*/
8692
public function deleting(Model $model, array $data): array
8793
{
8894
return $data;
8995
}
9096

97+
/**
98+
* @param TModel $model
99+
* @return TModel
100+
*/
91101
public function deleted(Model $model, array $data): Model
92102
{
93103
return $model;

src/DataTablesEditor.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@
1818
*/
1919
abstract class DataTablesEditor
2020
{
21+
/** @use \Yajra\DataTables\Concerns\WithCreateAction<TModel> */
2122
use Concerns\WithCreateAction;
23+
24+
/** @use \Yajra\DataTables\Concerns\WithEditAction<TModel> */
2225
use Concerns\WithEditAction;
26+
2327
use Concerns\WithForceDeleteAction;
28+
29+
/** @use \Yajra\DataTables\Concerns\WithRemoveAction<TModel> */
2430
use Concerns\WithRemoveAction;
2531
use Concerns\WithRestoreAction;
2632
use Concerns\WithUploadAction;

0 commit comments

Comments
 (0)