diff --git a/app/Filament/Resources/OrganisationResource/RelationManagers/VolunteersRelationManager.php b/app/Filament/Resources/OrganisationResource/RelationManagers/VolunteersRelationManager.php index ff41483..0dda4fd 100644 --- a/app/Filament/Resources/OrganisationResource/RelationManagers/VolunteersRelationManager.php +++ b/app/Filament/Resources/OrganisationResource/RelationManagers/VolunteersRelationManager.php @@ -130,7 +130,7 @@ public static function table(Table $table): Table ]) ->headerActions([ ExportAction::make(), -// VolunteerResource\Actions\ImportVolunteersAction::make(), + Tables\Actions\CreateAction::make() ->requiresConfirmation() ->modalHeading(__('volunteer.modal.heading')) diff --git a/app/Filament/Resources/VolunteerResource/Actions/ExportVolunteersExample.php b/app/Filament/Resources/VolunteerResource/Actions/ExportVolunteersExample.php deleted file mode 100644 index 4f5331b..0000000 --- a/app/Filament/Resources/VolunteerResource/Actions/ExportVolunteersExample.php +++ /dev/null @@ -1,64 +0,0 @@ -label(__('volunteer.labels.download_example')); - - $this->exports([ - ExcelExport::make() - ->withColumns([ - Column::make('first_name'), - Column::make('last_name'), - Column::make('email'), - Column::make('phone'), - Column::make('cnp'), - Column::make('rol'), - Column::make('specialisations'), - Column::make('has_first_aid_accreditation'), - Column::make('county') - ->formatStateUsing(fn ($state) => $state->name), - Column::make('city') - ->formatStateUsing(fn ($state) => $state->name), - ]), - ]); - } - - public function handleExport(array $data) - { - $examples = Volunteer::factory() - ->count(10) - ->make() - ->each(function ($item) { - $item->load('county'); - $item->load('city'); - - return $item; - }); - - $examplesArray = []; - foreach ($examples as $example) { - $examplesArray[] = $example; - } - - $exportable = $this->getSelectedExport($data); - $livewire = $this->getLivewire(); - - return app()->call([$exportable, 'hydrate'], [ - 'livewire' => $this->getLivewire(), - 'records' => $examples, - 'formData' => data_get($data, $exportable->getName()), - ])->export(); - } -} diff --git a/app/Filament/Resources/VolunteerResource/Actions/ImportVolunteersAction.php b/app/Filament/Resources/VolunteerResource/Actions/ImportVolunteersAction.php deleted file mode 100644 index 3a975a1..0000000 --- a/app/Filament/Resources/VolunteerResource/Actions/ImportVolunteersAction.php +++ /dev/null @@ -1,210 +0,0 @@ -label(__('volunteer.labels.import')); - $this->successNotificationTitle(__('volunteer.field.success_import')); - $this->visible(fn () => auth()->user()->isPlatformAdmin() || auth()->user()->isOrgAdmin()); - $this->handleBlankRows(true); - $this->fields([ - Select::make('organisation_id') - ->options(function () { - if (auth()->user()->isOrgAdmin()) { - $organisation = auth()->user()->organisation; - - return [$organisation->id => $organisation->name]; - } - - return Organisation::all() - ->pluck('name', 'id'); - }) - ->searchable() - ->label(__('organisation.label.singular')) - ->required(), - ImportField::make('first_name') - ->label(__('volunteer.field.first_name')) - ->required(), - ImportField::make('last_name') - ->label(__('volunteer.field.last_name')) - ->required(), - ImportField::make('email') - ->label(__('volunteer.field.email')) - ->required(), - ImportField::make('phone') - ->label(__('volunteer.field.phone')), - ImportField::make('cnp') - ->label(__('volunteer.field.cnp')), - ImportField::make('role') - ->label(__('volunteer.field.role')) - ->required(), - ImportField::make('specializations') - ->label(__('volunteer.field.specializations')) - ->required(), - ImportField::make('has_first_aid_accreditation') - ->label(__('volunteer.field.has_first_aid_accreditation')), - ImportField::make('county') - ->label(__('general.county')), - ImportField::make('city') - ->label(__('general.city')), - ]); - - $this->handleRecordCreation(function (array $data) { - $validator = \Validator::make($data, [ - 'organisation_id' => [ - 'required', - Rule::in(Organisation::all()->pluck('id')), - ], - 'first_name' => [ - 'required', - 'max:255', - 'string', - ], - 'last_name' => [ - 'required', - 'max:255', - 'string', - ], - 'email' => [ - 'required', - 'max:255', - 'email', - ], - 'phone' => [ - 'numeric', - 'min:10', - ], - 'role' => [ - 'required', - Rule::in(VolunteerRole::options()), - ], - 'specializations' => ['required'], - ]); - - $data = $validator->getData(); - $messages = $validator->getMessageBag(); - if ($messages->messages()) { - $this->setFailureMsg($messages->messages()); - - return new Volunteer(); - } - $roles = VolunteerRole::options(); - $role = array_search($data['role'], $roles); - - $specializations = explode(',', $data['specializations']); - $allSpecializations = VolunteerSpecialization::options(); - $newSpecializations = []; - foreach ($specializations as $specialization) { - $specializationFromEnum = array_search(trim($specialization), $allSpecializations); - if (! $specializationFromEnum) { - $this->setFailureMsg([ - __( - 'validation.in_array', - ['attribute' => __('volunteer.field.specializations') . ' (' . $specialization . ')', - 'other' => implode(', ', $allSpecializations), - ] - ), - ]); - - return new Volunteer(); - } - $newSpecializations[] = $specializationFromEnum; - } - - $firstAID = false; - if (isset($data['has_first_aid_accreditation'])) { - $firstAID = (bool) $data['has_first_aid_accreditation']; - } - - $fields = ['organisation_id' => $data['organisation_id'], - 'first_name' => $data['first_name'], - 'last_name' => $data['last_name'], - 'email' => $data['email'], - 'phone' => $data['phone'] ?? null, - 'cnp' => $data['cnp'] ?? null, - 'role' => $role, - 'specializations' => $newSpecializations, - 'has_first_aid_accreditation' => $firstAID, - ]; - - if (isset($data['county'])) { - $county = County::query() - ->where('name', 'like', trim($data['county'])) - ->first(); - - if (! $county) { - $this->setFailureMsg([ - __( - 'validation.in_array', - [ - 'attribute' => __('general.county') . ' (' . $data['county'] . ')', - 'other' => County::all() - ->map(fn ($item) => $item->name) - ->implode(', '), - ] - ), - ]); - - return new Volunteer(); - } - $fields['county_id'] = $county->id; - - if (isset($data['city'])) { - $city = City::query() - ->search(trim($data['city'])) - ->where('county_id', $county->id) - ->first(); - - if (! $city) { - $this->setFailureMsg([ - __( - 'validation.in_array', - [ - 'attribute' => __('general.city') . ' (' . $data['city'] . ')', - 'other' => __( - 'general.localities_from_county', - ['county' => $data['county']] - ), - ] - ), - ]); - - return new Volunteer(); - } - $fields['city_id'] = $city->id; - } - } - - return Volunteer::create($fields); - }); - } - - public function setFailureMsg(array $messages) - { - foreach ($messages as &$msg) { - $msg = \is_array($msg) ? implode(' ', $msg) : $msg; - } - $msgString = implode(' ', $messages); - $msgString = substr($msgString, 0, 100); - $this->failureNotificationTitle($msgString); - $this->failure(); - } -} diff --git a/app/Filament/Resources/VolunteerResource/Pages/ListVolunteers.php b/app/Filament/Resources/VolunteerResource/Pages/ListVolunteers.php index 38b6963..7c582df 100644 --- a/app/Filament/Resources/VolunteerResource/Pages/ListVolunteers.php +++ b/app/Filament/Resources/VolunteerResource/Pages/ListVolunteers.php @@ -5,8 +5,6 @@ namespace App\Filament\Resources\VolunteerResource\Pages; use App\Filament\Resources\VolunteerResource; -use App\Filament\Resources\VolunteerResource\Actions\ExportVolunteersExample; -use App\Filament\Resources\VolunteerResource\Actions\ImportVolunteersAction; use Filament\Pages\Actions; use Filament\Resources\Pages\ListRecords; use Illuminate\Database\Eloquent\Builder; @@ -19,8 +17,6 @@ protected function getActions(): array { return [ Actions\CreateAction::make(), - ImportVolunteersAction::make(), -// ExportVolunteersExample::make(), ]; } diff --git a/composer.json b/composer.json index 2463988..58ded64 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,7 @@ "laravel/tinker": "^2.8", "league/flysystem-aws-s3-v3": "^3.21", "pxlrbt/filament-excel": "^1.1", - "sentry/sentry-laravel": "^4.1", - "konnco/filament-import": "1.6.0" + "sentry/sentry-laravel": "^4.1" }, "require-dev": { "barryvdh/laravel-debugbar": "^3.13", @@ -31,8 +30,6 @@ "laravel/telescope": "^4.17", "mockery/mockery": "^1.6", "nunomaduro/collision": "^7.10", - "pestphp/pest": "^2.34", - "pestphp/pest-plugin-livewire": "^2.1", "phpunit/phpunit": "^10.4", "spatie/laravel-ignition": "^2.3" }, diff --git a/composer.lock b/composer.lock index fdb03a8..2d99c58 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "234b00b722c7a92367e53bdfc4724a73", + "content-hash": "7a70662ab504734cb42fc3e00403f5de", "packages": [ { "name": "akaunting/laravel-money", @@ -2494,76 +2494,6 @@ }, "time": "2024-01-31T15:40:42+00:00" }, - { - "name": "konnco/filament-import", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/konnco/filament-import.git", - "reference": "00c5f09be296f039cc4090a1e546637b48a4b43a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/konnco/filament-import/zipball/00c5f09be296f039cc4090a1e546637b48a4b43a", - "reference": "00c5f09be296f039cc4090a1e546637b48a4b43a", - "shasum": "" - }, - "require": { - "filament/filament": "^2.0", - "filament/notifications": "^2.0", - "illuminate/contracts": "^9.0|^10.0", - "illuminate/support": "^9.0|^10.0", - "maatwebsite/excel": "^3.1", - "php": "^8.0", - "psr/simple-cache": "^2.0|^3.0", - "spatie/laravel-package-tools": "^1.14" - }, - "require-dev": { - "laravel/pint": "^1.0", - "nunomaduro/collision": "^6.0|^7.0", - "nunomaduro/larastan": "^2.0", - "orchestra/testbench": "^7.0", - "pestphp/pest": "^1.21", - "pestphp/pest-plugin-laravel": "^1.1", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5|^10.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Konnco\\FilamentImport\\FilamentImportServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Konnco\\FilamentImport\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Franky So", - "email": "frankyso.mail@gmail.com" - } - ], - "keywords": [ - "filament-import", - "import", - "laravel" - ], - "support": { - "issues": "https://github.com/konnco/filament-import/issues", - "source": "https://github.com/konnco/filament-import/tree/1.6.0" - }, - "time": "2023-06-18T04:00:35+00:00" - }, { "name": "laravel/framework", "version": "v10.48.7", @@ -9445,100 +9375,6 @@ }, "time": "2023-06-14T05:06:27+00:00" }, - { - "name": "brianium/paratest", - "version": "v7.4.3", - "source": { - "type": "git", - "url": "https://github.com/paratestphp/paratest.git", - "reference": "64fcfd0e28a6b8078a19dbf9127be2ee645b92ec" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/64fcfd0e28a6b8078a19dbf9127be2ee645b92ec", - "reference": "64fcfd0e28a6b8078a19dbf9127be2ee645b92ec", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-simplexml": "*", - "fidry/cpu-core-counter": "^1.1.0", - "jean85/pretty-package-versions": "^2.0.5", - "php": "~8.2.0 || ~8.3.0", - "phpunit/php-code-coverage": "^10.1.11 || ^11.0.0", - "phpunit/php-file-iterator": "^4.1.0 || ^5.0.0", - "phpunit/php-timer": "^6.0.0 || ^7.0.0", - "phpunit/phpunit": "^10.5.9 || ^11.0.3", - "sebastian/environment": "^6.0.1 || ^7.0.0", - "symfony/console": "^6.4.3 || ^7.0.3", - "symfony/process": "^6.4.3 || ^7.0.3" - }, - "require-dev": { - "doctrine/coding-standard": "^12.0.0", - "ext-pcov": "*", - "ext-posix": "*", - "phpstan/phpstan": "^1.10.58", - "phpstan/phpstan-deprecation-rules": "^1.1.4", - "phpstan/phpstan-phpunit": "^1.3.15", - "phpstan/phpstan-strict-rules": "^1.5.2", - "squizlabs/php_codesniffer": "^3.9.0", - "symfony/filesystem": "^6.4.3 || ^7.0.3" - }, - "bin": [ - "bin/paratest", - "bin/paratest.bat", - "bin/paratest_for_phpstorm" - ], - "type": "library", - "autoload": { - "psr-4": { - "ParaTest\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Brian Scaturro", - "email": "scaturrob@gmail.com", - "role": "Developer" - }, - { - "name": "Filippo Tessarotto", - "email": "zoeslam@gmail.com", - "role": "Developer" - } - ], - "description": "Parallel testing for PHP", - "homepage": "https://github.com/paratestphp/paratest", - "keywords": [ - "concurrent", - "parallel", - "phpunit", - "testing" - ], - "support": { - "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v7.4.3" - }, - "funding": [ - { - "url": "https://github.com/sponsors/Slamdunk", - "type": "github" - }, - { - "url": "https://paypal.me/filippotessarotto", - "type": "paypal" - } - ], - "time": "2024-02-20T07:24:02+00:00" - }, { "name": "composer/class-map-generator", "version": "1.1.1", @@ -10400,67 +10236,6 @@ }, "time": "2024-01-02T13:46:09+00:00" }, - { - "name": "fidry/cpu-core-counter", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "fidry/makefile": "^0.2.0", - "fidry/php-cs-fixer-config": "^1.1.2", - "phpstan/extension-installer": "^1.2.0", - "phpstan/phpstan": "^1.9.2", - "phpstan/phpstan-deprecation-rules": "^1.0.0", - "phpstan/phpstan-phpunit": "^1.2.2", - "phpstan/phpstan-strict-rules": "^1.4.4", - "phpunit/phpunit": "^8.5.31 || ^9.5.26", - "webmozarts/strict-phpunit": "^7.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Fidry\\CpuCoreCounter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Théo FIDRY", - "email": "theo.fidry@gmail.com" - } - ], - "description": "Tiny utility to get the number of CPU cores.", - "keywords": [ - "CPU", - "core" - ], - "support": { - "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/1.1.0" - }, - "funding": [ - { - "url": "https://github.com/theofidry", - "type": "github" - } - ], - "time": "2024-02-07T09:43:46+00:00" - }, { "name": "filp/whoops", "version": "2.15.4", @@ -11714,321 +11489,6 @@ ], "time": "2023-10-11T15:45:01+00:00" }, - { - "name": "pestphp/pest", - "version": "v2.34.7", - "source": { - "type": "git", - "url": "https://github.com/pestphp/pest.git", - "reference": "a7a3e4240e341d0fee1c54814ce18adc26ce5a76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest/zipball/a7a3e4240e341d0fee1c54814ce18adc26ce5a76", - "reference": "a7a3e4240e341d0fee1c54814ce18adc26ce5a76", - "shasum": "" - }, - "require": { - "brianium/paratest": "^7.3.1", - "nunomaduro/collision": "^7.10.0|^8.1.1", - "nunomaduro/termwind": "^1.15.1|^2.0.1", - "pestphp/pest-plugin": "^2.1.1", - "pestphp/pest-plugin-arch": "^2.7.0", - "php": "^8.1.0", - "phpunit/phpunit": "^10.5.17" - }, - "conflict": { - "phpunit/phpunit": ">10.5.17", - "sebastian/exporter": "<5.1.0", - "webmozart/assert": "<1.11.0" - }, - "require-dev": { - "pestphp/pest-dev-tools": "^2.16.0", - "pestphp/pest-plugin-type-coverage": "^2.8.1", - "symfony/process": "^6.4.0|^7.0.4" - }, - "bin": [ - "bin/pest" - ], - "type": "library", - "extra": { - "pest": { - "plugins": [ - "Pest\\Plugins\\Bail", - "Pest\\Plugins\\Cache", - "Pest\\Plugins\\Coverage", - "Pest\\Plugins\\Init", - "Pest\\Plugins\\Environment", - "Pest\\Plugins\\Help", - "Pest\\Plugins\\Memory", - "Pest\\Plugins\\Only", - "Pest\\Plugins\\Printer", - "Pest\\Plugins\\ProcessIsolation", - "Pest\\Plugins\\Profile", - "Pest\\Plugins\\Retry", - "Pest\\Plugins\\Snapshot", - "Pest\\Plugins\\Verbose", - "Pest\\Plugins\\Version", - "Pest\\Plugins\\Parallel" - ] - }, - "phpstan": { - "includes": [ - "extension.neon" - ] - } - }, - "autoload": { - "files": [ - "src/Functions.php", - "src/Pest.php" - ], - "psr-4": { - "Pest\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nuno Maduro", - "email": "enunomaduro@gmail.com" - } - ], - "description": "The elegant PHP Testing Framework.", - "keywords": [ - "framework", - "pest", - "php", - "test", - "testing", - "unit" - ], - "support": { - "issues": "https://github.com/pestphp/pest/issues", - "source": "https://github.com/pestphp/pest/tree/v2.34.7" - }, - "funding": [ - { - "url": "https://www.paypal.com/paypalme/enunomaduro", - "type": "custom" - }, - { - "url": "https://github.com/nunomaduro", - "type": "github" - } - ], - "time": "2024-04-05T07:44:17+00:00" - }, - { - "name": "pestphp/pest-plugin", - "version": "v2.1.1", - "source": { - "type": "git", - "url": "https://github.com/pestphp/pest-plugin.git", - "reference": "e05d2859e08c2567ee38ce8b005d044e72648c0b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest-plugin/zipball/e05d2859e08c2567ee38ce8b005d044e72648c0b", - "reference": "e05d2859e08c2567ee38ce8b005d044e72648c0b", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^2.0.0", - "composer-runtime-api": "^2.2.2", - "php": "^8.1" - }, - "conflict": { - "pestphp/pest": "<2.2.3" - }, - "require-dev": { - "composer/composer": "^2.5.8", - "pestphp/pest": "^2.16.0", - "pestphp/pest-dev-tools": "^2.16.0" - }, - "type": "composer-plugin", - "extra": { - "class": "Pest\\Plugin\\Manager" - }, - "autoload": { - "psr-4": { - "Pest\\Plugin\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "The Pest plugin manager", - "keywords": [ - "framework", - "manager", - "pest", - "php", - "plugin", - "test", - "testing", - "unit" - ], - "support": { - "source": "https://github.com/pestphp/pest-plugin/tree/v2.1.1" - }, - "funding": [ - { - "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", - "type": "custom" - }, - { - "url": "https://github.com/nunomaduro", - "type": "github" - }, - { - "url": "https://www.patreon.com/nunomaduro", - "type": "patreon" - } - ], - "time": "2023-08-22T08:40:06+00:00" - }, - { - "name": "pestphp/pest-plugin-arch", - "version": "v2.7.0", - "source": { - "type": "git", - "url": "https://github.com/pestphp/pest-plugin-arch.git", - "reference": "d23b2d7498475354522c3818c42ef355dca3fcda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/d23b2d7498475354522c3818c42ef355dca3fcda", - "reference": "d23b2d7498475354522c3818c42ef355dca3fcda", - "shasum": "" - }, - "require": { - "nunomaduro/collision": "^7.10.0|^8.1.0", - "pestphp/pest-plugin": "^2.1.1", - "php": "^8.1", - "ta-tikoma/phpunit-architecture-test": "^0.8.4" - }, - "require-dev": { - "pestphp/pest": "^2.33.0", - "pestphp/pest-dev-tools": "^2.16.0" - }, - "type": "library", - "extra": { - "pest": { - "plugins": [ - "Pest\\Arch\\Plugin" - ] - } - }, - "autoload": { - "files": [ - "src/Autoload.php" - ], - "psr-4": { - "Pest\\Arch\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "The Arch plugin for Pest PHP.", - "keywords": [ - "arch", - "architecture", - "framework", - "pest", - "php", - "plugin", - "test", - "testing", - "unit" - ], - "support": { - "source": "https://github.com/pestphp/pest-plugin-arch/tree/v2.7.0" - }, - "funding": [ - { - "url": "https://www.paypal.com/paypalme/enunomaduro", - "type": "custom" - }, - { - "url": "https://github.com/nunomaduro", - "type": "github" - } - ], - "time": "2024-01-26T09:46:42+00:00" - }, - { - "name": "pestphp/pest-plugin-livewire", - "version": "v2.1.0", - "source": { - "type": "git", - "url": "https://github.com/pestphp/pest-plugin-livewire.git", - "reference": "e72a2f850f727dfdb6bfa6e2ee6ff478ccc93f97" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pestphp/pest-plugin-livewire/zipball/e72a2f850f727dfdb6bfa6e2ee6ff478ccc93f97", - "reference": "e72a2f850f727dfdb6bfa6e2ee6ff478ccc93f97", - "shasum": "" - }, - "require": { - "livewire/livewire": "^2.12.3|^3.0", - "pestphp/pest": "^2.9.1", - "php": "^8.1" - }, - "require-dev": { - "orchestra/testbench": "^8.5.10", - "pestphp/pest-dev-tools": "^2.12.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/Autoload.php" - ], - "psr-4": { - "Pest\\Livewire\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "The Pest Livewire Plugin", - "keywords": [ - "framework", - "livewire", - "pest", - "php", - "plugin", - "test", - "testing", - "unit" - ], - "support": { - "source": "https://github.com/pestphp/pest-plugin-livewire/tree/v2.1.0" - }, - "funding": [ - { - "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", - "type": "custom" - }, - { - "url": "https://github.com/nunomaduro", - "type": "github" - }, - { - "url": "https://www.patreon.com/nunomaduro", - "type": "patreon" - } - ], - "time": "2023-07-20T16:28:21+00:00" - }, { "name": "phar-io/manifest", "version": "2.0.4", @@ -12200,63 +11660,6 @@ }, "time": "2020-06-27T09:03:43+00:00" }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, { "name": "phpdocumentor/type-resolver", "version": "1.8.2", @@ -14280,65 +13683,6 @@ ], "time": "2024-01-23T15:02:46+00:00" }, - { - "name": "ta-tikoma/phpunit-architecture-test", - "version": "0.8.4", - "source": { - "type": "git", - "url": "https://github.com/ta-tikoma/phpunit-architecture-test.git", - "reference": "89f0dea1cb0f0d5744d3ec1764a286af5e006636" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ta-tikoma/phpunit-architecture-test/zipball/89f0dea1cb0f0d5744d3ec1764a286af5e006636", - "reference": "89f0dea1cb0f0d5744d3ec1764a286af5e006636", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.18.0 || ^5.0.0", - "php": "^8.1.0", - "phpdocumentor/reflection-docblock": "^5.3.0", - "phpunit/phpunit": "^10.5.5 || ^11.0.0", - "symfony/finder": "^6.4.0 || ^7.0.0" - }, - "require-dev": { - "laravel/pint": "^1.13.7", - "phpstan/phpstan": "^1.10.52" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPUnit\\Architecture\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ni Shi", - "email": "futik0ma011@gmail.com" - }, - { - "name": "Nuno Maduro", - "email": "enunomaduro@gmail.com" - } - ], - "description": "Methods for testing application architecture", - "keywords": [ - "architecture", - "phpunit", - "stucture", - "test", - "testing" - ], - "support": { - "issues": "https://github.com/ta-tikoma/phpunit-architecture-test/issues", - "source": "https://github.com/ta-tikoma/phpunit-architecture-test/tree/0.8.4" - }, - "time": "2024-01-05T14:10:56+00:00" - }, { "name": "theseer/tokenizer", "version": "1.2.3", diff --git a/database/factories/OrganisationFactory.php b/database/factories/OrganisationFactory.php index 2c532cd..8fda2b0 100644 --- a/database/factories/OrganisationFactory.php +++ b/database/factories/OrganisationFactory.php @@ -159,16 +159,19 @@ public function withUserAndDocuments() public function withUserAndVolunteers() { return $this->afterCreating(function (Organisation $organisation) { -// var_dump($organisation->email, $organisation->id, User::all()->pluck('email')); -// dd(Organisation::all()->pluck('email', 'id'), $organisation); -// User::factory(['email' => $organisation->email]) -// ->orgAdmin() -// ->for($organisation) -// ->create(); + // User::factory(['email' => $organisation->email]) + // ->orgAdmin() + // ->for($organisation) + // ->create(); Volunteer::factory() ->for($organisation) - ->count(5) + ->translator() + ->create(); + + Volunteer::factory() + ->for($organisation) + ->count(4) ->create(); }); } diff --git a/database/factories/VolunteerFactory.php b/database/factories/VolunteerFactory.php index 1a67218..f83f489 100644 --- a/database/factories/VolunteerFactory.php +++ b/database/factories/VolunteerFactory.php @@ -36,4 +36,11 @@ public function definition() 'has_first_aid_accreditation' => fake()->boolean(), ]; } + + public function translator(): static + { + return $this->state(fn ($attributes) => [ + 'specializations' => array_merge($attributes['specializations'], [VolunteerSpecialization::translator]), + ]); + } } diff --git a/tests/Feature/Documents/DocumentsBaseTest.php b/tests/Feature/Documents/DocumentsBase.php similarity index 99% rename from tests/Feature/Documents/DocumentsBaseTest.php rename to tests/Feature/Documents/DocumentsBase.php index 3f393a7..c407c3f 100644 --- a/tests/Feature/Documents/DocumentsBaseTest.php +++ b/tests/Feature/Documents/DocumentsBase.php @@ -21,7 +21,7 @@ use Livewire\Testing\TestableLivewire; use Tests\TestCase; -abstract class DocumentsBaseTest extends TestCase +abstract class DocumentsBase extends TestCase { use RefreshDatabase; diff --git a/tests/Feature/Documents/OrganisationAdminTest.php b/tests/Feature/Documents/OrganisationAdminTest.php index f70ce3c..aa14fef 100644 --- a/tests/Feature/Documents/OrganisationAdminTest.php +++ b/tests/Feature/Documents/OrganisationAdminTest.php @@ -11,7 +11,7 @@ use App\Models\User; use Livewire\Livewire; -class OrganisationAdminTest extends DocumentsBaseTest +class OrganisationAdminTest extends DocumentsBase { protected function setUp(): void { diff --git a/tests/Feature/Documents/PlatformAdminTest.php b/tests/Feature/Documents/PlatformAdminTest.php index d2006b1..d34ddb8 100644 --- a/tests/Feature/Documents/PlatformAdminTest.php +++ b/tests/Feature/Documents/PlatformAdminTest.php @@ -12,7 +12,7 @@ use Livewire\Livewire; use Tests\Traits\ActingAsPlatformAdmin; -class PlatformAdminTest extends DocumentsBaseTest +class PlatformAdminTest extends DocumentsBase { use ActingAsPlatformAdmin; diff --git a/tests/Feature/Documents/PlatformCoordinatorTest.php b/tests/Feature/Documents/PlatformCoordinatorTest.php index ace6d79..23bbbf3 100644 --- a/tests/Feature/Documents/PlatformCoordinatorTest.php +++ b/tests/Feature/Documents/PlatformCoordinatorTest.php @@ -10,7 +10,7 @@ use App\Models\User; use Livewire\Livewire; -class PlatformCoordinatorTest extends DocumentsBaseTest +class PlatformCoordinatorTest extends DocumentsBase { protected function setUp(): void { diff --git a/tests/Feature/Volunteers/OrganisationAdminTest.php b/tests/Feature/Volunteers/OrganisationAdminTest.php index a2ebecb..e4ac4d2 100644 --- a/tests/Feature/Volunteers/OrganisationAdminTest.php +++ b/tests/Feature/Volunteers/OrganisationAdminTest.php @@ -17,7 +17,7 @@ use App\Models\Volunteer; use Livewire\Livewire; -class OrganisationAdminTest extends VolunteersBaseTest +class OrganisationAdminTest extends VolunteersBase { protected function setUp(): void { diff --git a/tests/Feature/Volunteers/PlatformAdminTest.php b/tests/Feature/Volunteers/PlatformAdminTest.php index 099437d..e0c08b2 100644 --- a/tests/Feature/Volunteers/PlatformAdminTest.php +++ b/tests/Feature/Volunteers/PlatformAdminTest.php @@ -17,7 +17,7 @@ use Livewire\Livewire; use Tests\Traits\ActingAsPlatformAdmin; -class PlatformAdminTest extends VolunteersBaseTest +class PlatformAdminTest extends VolunteersBase { use ActingAsPlatformAdmin; diff --git a/tests/Feature/Volunteers/PlatformCoordinatorTest.php b/tests/Feature/Volunteers/PlatformCoordinatorTest.php index acbf172..e7f5378 100644 --- a/tests/Feature/Volunteers/PlatformCoordinatorTest.php +++ b/tests/Feature/Volunteers/PlatformCoordinatorTest.php @@ -14,7 +14,7 @@ use App\Models\Volunteer; use Livewire\Livewire; -class PlatformCoordinatorTest extends VolunteersBaseTest +class PlatformCoordinatorTest extends VolunteersBase { protected function setUp(): void { diff --git a/tests/Feature/Volunteers/VolunteersBaseTest.php b/tests/Feature/Volunteers/VolunteersBase.php similarity index 93% rename from tests/Feature/Volunteers/VolunteersBaseTest.php rename to tests/Feature/Volunteers/VolunteersBase.php index fe2b910..681f76e 100644 --- a/tests/Feature/Volunteers/VolunteersBaseTest.php +++ b/tests/Feature/Volunteers/VolunteersBase.php @@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Notification; use Tests\TestCase; -abstract class VolunteersBaseTest extends TestCase +abstract class VolunteersBase extends TestCase { use RefreshDatabase;