This commit is contained in:
philipp lang 2023-12-30 19:02:15 +01:00
parent b896c37c31
commit 1dc797948e
3 changed files with 16 additions and 4 deletions

View File

@ -4,7 +4,6 @@ namespace App\Group\Actions;
use App\Group;
use App\Group\Enums\Level;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\Rule;
use Lorisleiva\Actions\ActionRequest;
@ -14,6 +13,9 @@ class GroupBulkstoreAction
{
use AsAction;
/**
* @return array<string, string|array<int, string|Rule>>
*/
public function rules(): array
{
return [
@ -23,7 +25,10 @@ class GroupBulkstoreAction
];
}
public function handle($groups): void
/**
* @param array<int, array{id: int, inner_name: string, level: string}> $groups
*/
public function handle(array $groups): void
{
foreach ($groups as $payload) {
Group::find($payload['id'])->update(['level' => $payload['level'], 'inner_name' => $payload['inner_name']]);

View File

@ -2,9 +2,13 @@
namespace App\Group\Resources;
use App\Group;
use App\Lib\HasMeta;
use Illuminate\Http\Resources\Json\JsonResource;
/**
* @mixin Group
*/
class GroupResource extends JsonResource
{
@ -14,7 +18,7 @@ class GroupResource extends JsonResource
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
* @return array<string, mixed>
*/
public function toArray($request)
{
@ -27,6 +31,9 @@ class GroupResource extends JsonResource
];
}
/**
* @return array<string, mixed>
*/
public static function meta(): array
{
return [

View File

@ -5,7 +5,7 @@ namespace Illuminate\Testing;
use Symfony\Component\HttpFoundation\File\File;
/**
* @method self assertInertiaPath(string $path, string|array<string, mixed>|int $value)
* @method self assertInertiaPath(string $path, string|array<string, mixed>|int|null $value)
* @method self assertPdfPageCount(int $count)
* @method self assertPdfName(string $filename)
* @method File getFile()