Skip to content

Commit

Permalink
uuid models support for nesting modules
Browse files Browse the repository at this point in the history
  • Loading branch information
yamaha252 committed Jul 31, 2023
1 parent 85b6719 commit 36517b3
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/Http/Controllers/Admin/AppSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function setUpController(): void
}
}

public function update(int|string|TwillModelContract $id, ?int $submoduleId = null): JsonResponse
public function update(int|string|TwillModelContract $id, int|string|null $submoduleId = null): JsonResponse
{
$model = AppSetting::findOrFail($id);

Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/Admin/FileLibraryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function filters(): TableFilters
]);
}

public function index(?int $parentModuleId = null): mixed
public function index(int|string|null $parentModuleId = null): mixed
{
if ($this->request->has('except')) {
$prependScope['exceptIds'] = $this->request->get('except');
Expand Down Expand Up @@ -172,7 +172,7 @@ protected function getRequestFilters(): array
}

/**
* @param int|null $parentModuleId
* @param int|string|null $parentModuleId
* @return JsonResponse
* @throws BindingResolutionException
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/Admin/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function edit(int|string|TwillModelContract $id): mixed
return parent::edit($id);
}

public function update(int|string|TwillModelContract $id, ?int $submoduleId = null): JsonResponse
public function update(int|string|TwillModelContract $id, int|string|null $submoduleId = null): JsonResponse
{
$this->authorizableOptions['edit'] = 'edit-group';

Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/Admin/MediaLibraryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function filters(): TableFilters
]);
}

public function index(?int $parentModuleId = null): array
public function index(int|string|null $parentModuleId = null): array
{
if ($this->request->has('except')) {
$prependScope['exceptIds'] = $this->request->get('except');
Expand Down Expand Up @@ -150,7 +150,7 @@ protected function getRequestFilters(): array
}

/**
* @param int|null $parentModuleId
* @param int|string|null $parentModuleId
* @return
*/
public function store($parentModuleId = null)
Expand Down
16 changes: 8 additions & 8 deletions src/Http/Controllers/Admin/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ abstract class ModuleController extends Controller
protected $submodule = false;

/**
* @var int|null
* @var int|string|null
*/
protected $submoduleParentId = null;

Expand Down Expand Up @@ -970,7 +970,7 @@ protected function getParentModuleIdFromRequest(Request $request)
/**
* @return IlluminateView|JsonResponse
*/
public function index(?int $parentModuleId = null): mixed
public function index(int|string|null $parentModuleId = null): mixed
{
$this->authorizeOption('list', $this->moduleName);

Expand Down Expand Up @@ -1032,7 +1032,7 @@ public function browser(): JsonResponse
}

/**
* @param int|null $parentModuleId
* @param int|string|null $parentModuleId
* @return \Illuminate\Http\JsonResponse
*/
public function store($parentModuleId = null)
Expand Down Expand Up @@ -1093,7 +1093,7 @@ public function store($parentModuleId = null)
/**
* @param Request $request
* @param int|string $id
* @param int|null $submoduleId
* @param int|string|null $submoduleId
* @return \Illuminate\Http\RedirectResponse
*/
public function show($id, $submoduleId = null)
Expand Down Expand Up @@ -1169,7 +1169,7 @@ public function edit(TwillModelContract|int|string $id): mixed
);
}

public function create(int $parentModuleId = null): JsonResponse|RedirectResponse|IlluminateView
public function create(int|string $parentModuleId = null): JsonResponse|RedirectResponse|IlluminateView
{
if (! $this->getIndexOption('skipCreateModal')) {
return Redirect::to(
Expand Down Expand Up @@ -1205,7 +1205,7 @@ public function create(int $parentModuleId = null): JsonResponse|RedirectRespons
);
}

public function update(int|string|TwillModelContract $id, ?int $submoduleId = null): JsonResponse
public function update(int|string|TwillModelContract $id, int|string|null $submoduleId = null): JsonResponse
{
[$item, $id] = $this->itemAndIdFromRequest($id);

Expand Down Expand Up @@ -1435,7 +1435,7 @@ public function bulkPublish(): JsonResponse
);
}

public function duplicate(int|string|TwillModelContract $id, ?int $submoduleId = null): JsonResponse
public function duplicate(int|string|TwillModelContract $id, int|string|null $submoduleId = null): JsonResponse
{
[$item, $id] = $this->itemAndIdFromRequest($id);

Expand Down Expand Up @@ -1475,7 +1475,7 @@ public function duplicate(int|string|TwillModelContract $id, ?int $submoduleId =
);
}

public function destroy(int|string|TwillModelContract $id, ?int $submoduleId = null): JsonResponse
public function destroy(int|string|TwillModelContract $id, int|string|null $submoduleId = null): JsonResponse
{
[$item, $id] = $this->itemAndIdFromRequest($id);

Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/Admin/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected function indexItemData($item): array
return ['edit' => $canEdit ? $this->getModuleRoute($item->id, 'edit') : null];
}

public function index(?int $parentModuleId = null): mixed
public function index(int|string|null $parentModuleId = null): mixed
{
// Superadmins can reorder groups to determine the access-level of each one.
// A given group can't edit other groups with a higher access-level.
Expand All @@ -103,7 +103,7 @@ public function edit(int|string|TwillModelContract $id): mixed
return parent::edit($id);
}

public function update(int|string|TwillModelContract $id, ?int $submoduleId = null): JsonResponse
public function update(int|string|TwillModelContract $id, int|string|null $submoduleId = null): JsonResponse
{
$this->authorizableOptions['edit'] = 'edit-role';

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/Admin/SingletonModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ abstract class SingletonModuleController extends ModuleController
{
protected $permalinkBase = '';

public function index(?int $parentModuleId = null): mixed
public function index(int|string|null $parentModuleId = null): mixed
{
throw new \Exception("{$this->getModelName()} has no index");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/Admin/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public function edit(int|string|TwillModelContract $id): mixed
return parent::edit($id);
}

public function update(int|string|TwillModelContract $id, ?int $submoduleId = null): JsonResponse
public function update(int|string|TwillModelContract $id, int|string|null $submoduleId = null): JsonResponse
{
$this->authorizableOptions['edit'] = 'edit-user';

Expand Down

0 comments on commit 36517b3

Please sign in to comment.