From 294a25cb447e965e0f126a57093a91dd9e90b406 Mon Sep 17 00:00:00 2001 From: Sagar Date: Tue, 23 Apr 2024 16:52:54 +0200 Subject: [PATCH 1/6] feat: created geolocation and organism resources --- .../Resources/GeoLocationResource.php | 98 +++++++++++++++++++ .../Pages/CreateGeoLocation.php | 21 ++++ .../Pages/EditGeoLocation.php | 19 ++++ .../Pages/ListGeoLocations.php | 19 ++++ .../Dashboard/Resources/OrganismResource.php | 83 ++++++++++++++++ .../OrganismResource/Pages/CreateOrganism.php | 12 +++ .../OrganismResource/Pages/EditOrganism.php | 19 ++++ .../OrganismResource/Pages/ListOrganisms.php | 19 ++++ 8 files changed, 290 insertions(+) create mode 100644 app/Filament/Dashboard/Resources/GeoLocationResource.php create mode 100644 app/Filament/Dashboard/Resources/GeoLocationResource/Pages/CreateGeoLocation.php create mode 100644 app/Filament/Dashboard/Resources/GeoLocationResource/Pages/EditGeoLocation.php create mode 100644 app/Filament/Dashboard/Resources/GeoLocationResource/Pages/ListGeoLocations.php create mode 100644 app/Filament/Dashboard/Resources/OrganismResource.php create mode 100644 app/Filament/Dashboard/Resources/OrganismResource/Pages/CreateOrganism.php create mode 100644 app/Filament/Dashboard/Resources/OrganismResource/Pages/EditOrganism.php create mode 100644 app/Filament/Dashboard/Resources/OrganismResource/Pages/ListOrganisms.php diff --git a/app/Filament/Dashboard/Resources/GeoLocationResource.php b/app/Filament/Dashboard/Resources/GeoLocationResource.php new file mode 100644 index 00000000..b376c3b7 --- /dev/null +++ b/app/Filament/Dashboard/Resources/GeoLocationResource.php @@ -0,0 +1,98 @@ +schema([ + TextInput::make('name') + ->required() + ->maxLength(255), + // Fieldset::make('Molecule') + // ->relationship('molecules', 'identifier') + // ->schema([ + // TextInput::make('identifier'), + // TextInput::make('locations'), + // ]) + // TextInput::make('molecule_id') + // ->label('Molecule') + // ->relationship('molecule') + // ->placeholder('Enter the molecule Identifier') + // ->required(), + // TextInput::make('locations') + // ->label('Locations') + // ->relationship('molecule') + // ->placeholder('soil, water, etc.') + // ->helperText('Enter where in this Geo-Location these molecules can be found') + // ->required(), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + Tables\Columns\TextColumn::make('name') + ->searchable(), + Tables\Columns\TextColumn::make('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('updated_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + ]) + ->filters([ + // + ]) + ->actions([ + Tables\Actions\EditAction::make(), + ]) + ->bulkActions([ + Tables\Actions\BulkActionGroup::make([ + Tables\Actions\DeleteBulkAction::make(), + ]), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListGeoLocations::route('/'), + 'create' => Pages\CreateGeoLocation::route('/create'), + 'edit' => Pages\EditGeoLocation::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Dashboard/Resources/GeoLocationResource/Pages/CreateGeoLocation.php b/app/Filament/Dashboard/Resources/GeoLocationResource/Pages/CreateGeoLocation.php new file mode 100644 index 00000000..d8279a4f --- /dev/null +++ b/app/Filament/Dashboard/Resources/GeoLocationResource/Pages/CreateGeoLocation.php @@ -0,0 +1,21 @@ +data['molecule_id'])->get(); + // $this->data['molecule_id'] = $molecule[0]->id; + // dd($this->data); + // $this->data->molecules()->attach($molecule); + } +} diff --git a/app/Filament/Dashboard/Resources/GeoLocationResource/Pages/EditGeoLocation.php b/app/Filament/Dashboard/Resources/GeoLocationResource/Pages/EditGeoLocation.php new file mode 100644 index 00000000..1acb624b --- /dev/null +++ b/app/Filament/Dashboard/Resources/GeoLocationResource/Pages/EditGeoLocation.php @@ -0,0 +1,19 @@ +schema([ + Forms\Components\TextInput::make('name') + ->required() + ->maxLength(255), + Forms\Components\TextInput::make('ontology') + ->maxLength(255), + ]); + } + + public static function table(Table $table): Table + { + return $table + ->columns([ + Tables\Columns\TextColumn::make('name') + ->searchable(), + Tables\Columns\TextColumn::make('ontology') + ->searchable(), + Tables\Columns\TextColumn::make('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('updated_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + ]) + ->filters([ + // + ]) + ->actions([ + Tables\Actions\EditAction::make(), + ]) + ->bulkActions([ + Tables\Actions\BulkActionGroup::make([ + Tables\Actions\DeleteBulkAction::make(), + ]), + ]); + } + + public static function getRelations(): array + { + return [ + // + ]; + } + + public static function getPages(): array + { + return [ + 'index' => Pages\ListOrganisms::route('/'), + 'create' => Pages\CreateOrganism::route('/create'), + 'edit' => Pages\EditOrganism::route('/{record}/edit'), + ]; + } +} diff --git a/app/Filament/Dashboard/Resources/OrganismResource/Pages/CreateOrganism.php b/app/Filament/Dashboard/Resources/OrganismResource/Pages/CreateOrganism.php new file mode 100644 index 00000000..a67f7eda --- /dev/null +++ b/app/Filament/Dashboard/Resources/OrganismResource/Pages/CreateOrganism.php @@ -0,0 +1,12 @@ + Date: Tue, 23 Apr 2024 16:53:37 +0200 Subject: [PATCH 2/6] feat: created relationship managers for geolocation and organism --- .../Dashboard/Resources/MoleculeResource.php | 4 ++ .../GeoLocationRelationManager.php | 50 +++++++++++++++++++ .../OrganismsRelationManager.php | 50 +++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/GeoLocationRelationManager.php create mode 100644 app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php diff --git a/app/Filament/Dashboard/Resources/MoleculeResource.php b/app/Filament/Dashboard/Resources/MoleculeResource.php index 739bb07c..cc0eb5d4 100644 --- a/app/Filament/Dashboard/Resources/MoleculeResource.php +++ b/app/Filament/Dashboard/Resources/MoleculeResource.php @@ -7,6 +7,8 @@ use App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers\CollectionsRelationManager; use App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers\MoleculesRelationManager; use App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers\PropertiesRelationManager; +use App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers\GeoLocationRelationManager; +use App\Filament\Dashboard\Resources\MoleculeResource\RelationManagers\OrganismsRelationManager; use App\Models\Molecule; use Filament\Forms\Components\TextArea; use Filament\Forms\Components\TextInput; @@ -81,6 +83,8 @@ public static function getRelations(): array CollectionsRelationManager::class, CitationsRelationManager::class, MoleculesRelationManager::class, + GeoLocationRelationManager::class, + OrganismsRelationManager::class, AuditsRelationManager::class, ]; } diff --git a/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/GeoLocationRelationManager.php b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/GeoLocationRelationManager.php new file mode 100644 index 00000000..3e1ab77f --- /dev/null +++ b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/GeoLocationRelationManager.php @@ -0,0 +1,50 @@ +schema([ + Forms\Components\TextInput::make('name') + ->required() + ->maxLength(255), + ]); + } + + public function table(Table $table): Table + { + return $table + ->recordTitleAttribute('name') + ->columns([ + Tables\Columns\TextColumn::make('name'), + ]) + ->filters([ + // + ]) + ->headerActions([ + Tables\Actions\AttachAction::make() + ->multiple(), + ]) + ->actions([ + Tables\Actions\DetachAction::make(), + ]) + ->bulkActions([ + Tables\Actions\BulkActionGroup::make([ + Tables\Actions\DetachBulkAction::make(), + ]), + ]); + } +} diff --git a/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php new file mode 100644 index 00000000..8c8c0a7b --- /dev/null +++ b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php @@ -0,0 +1,50 @@ +schema([ + Forms\Components\TextInput::make('name') + ->required() + ->maxLength(255), + ]); + } + + public function table(Table $table): Table + { + return $table + ->recordTitleAttribute('name') + ->columns([ + Tables\Columns\TextColumn::make('name'), + ]) + ->filters([ + // + ]) + ->headerActions([ + Tables\Actions\AttachAction::make() + ->multiple(), + ]) + ->actions([ + Tables\Actions\DetachAction::make(), + ]) + ->bulkActions([ + Tables\Actions\BulkActionGroup::make([ + Tables\Actions\DetachBulkAction::make(), + ]), + ]); + } +} From 3e43beadf928d0be9540663f2ca2dbcd3b251cfe Mon Sep 17 00:00:00 2001 From: Sagar Date: Wed, 24 Apr 2024 15:54:34 +0200 Subject: [PATCH 3/6] chore: nullified organism_parts and locations in the pivot tables for now. --- .../2024_04_10_133440_create_molecule_organism_table.php | 2 +- .../2024_04_10_185145_create_geo_location_molecule_table.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/migrations/2024_04_10_133440_create_molecule_organism_table.php b/database/migrations/2024_04_10_133440_create_molecule_organism_table.php index 20466612..27b0cd38 100644 --- a/database/migrations/2024_04_10_133440_create_molecule_organism_table.php +++ b/database/migrations/2024_04_10_133440_create_molecule_organism_table.php @@ -15,7 +15,7 @@ public function up(): void $table->id(); $table->foreignId('organism_id')->constrained()->onDelete('cascade'); $table->foreignId('molecule_id')->constrained()->onDelete('cascade'); - $table->longText('organism_parts'); + $table->longText('organism_parts')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2024_04_10_185145_create_geo_location_molecule_table.php b/database/migrations/2024_04_10_185145_create_geo_location_molecule_table.php index 3ba52430..59142e35 100644 --- a/database/migrations/2024_04_10_185145_create_geo_location_molecule_table.php +++ b/database/migrations/2024_04_10_185145_create_geo_location_molecule_table.php @@ -15,7 +15,7 @@ public function up(): void $table->id(); $table->foreignId('geo_location_id')->constrained()->onDelete('cascade'); $table->foreignId('molecule_id')->constrained()->onDelete('cascade'); - $table->longText('locations'); + $table->longText('locations')->nullable(); $table->timestamps(); }); } From c51050cc1a910ac221a689baebf8efda5920bb2e Mon Sep 17 00:00:00 2001 From: Sagar Date: Thu, 25 Apr 2024 11:48:20 +0200 Subject: [PATCH 4/6] feat: created geolocation and organism resources and their relation managers for molecule resource --- .../GeoLocationRelationManager.php | 14 ++++++++++++- .../OrganismsRelationManager.php | 21 ++++++++++++++++++- app/Models/GeoLocation.php | 2 +- app/Models/Molecule.php | 4 ++-- app/Models/Organism.php | 2 +- 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/GeoLocationRelationManager.php b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/GeoLocationRelationManager.php index 3e1ab77f..2c3d8824 100644 --- a/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/GeoLocationRelationManager.php +++ b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/GeoLocationRelationManager.php @@ -9,6 +9,7 @@ use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\SoftDeletingScope; +use Filament\Tables\Actions\AttachAction; class GeoLocationRelationManager extends RelationManager { @@ -30,15 +31,26 @@ public function table(Table $table): Table ->recordTitleAttribute('name') ->columns([ Tables\Columns\TextColumn::make('name'), + Tables\Columns\TextColumn::make('locations'), ]) ->filters([ // ]) ->headerActions([ Tables\Actions\AttachAction::make() - ->multiple(), + ->preloadRecordSelect() + ->form(fn (AttachAction $action): array => [ + $action->getRecordSelect(), + Forms\Components\TextInput::make('locations') + ]), ]) ->actions([ + Tables\Actions\EditAction::make() + ->form(function ($action) { + return [ + Forms\Components\TextInput::make('locations'), + ]; + }), Tables\Actions\DetachAction::make(), ]) ->bulkActions([ diff --git a/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php index 8c8c0a7b..cdcc1594 100644 --- a/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php +++ b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php @@ -8,7 +8,11 @@ use Filament\Tables; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Support\Facades\DB; use Illuminate\Database\Eloquent\SoftDeletingScope; +use Filament\Tables\Actions\AttachAction; +use Filament\Tables\Actions\EditAction; +use App\Models\Organism; class OrganismsRelationManager extends RelationManager { @@ -30,15 +34,30 @@ public function table(Table $table): Table ->recordTitleAttribute('name') ->columns([ Tables\Columns\TextColumn::make('name'), + Tables\Columns\TextColumn::make('organism_parts'), ]) + // ->allowDuplicates() ->filters([ // ]) ->headerActions([ Tables\Actions\AttachAction::make() - ->multiple(), + ->preloadRecordSelect() + ->form(fn (AttachAction $action): array => [ + $action->getRecordSelect(), + Forms\Components\TextInput::make('organism_parts') + ]), ]) ->actions([ + Tables\Actions\EditAction::make() + ->form(function ($action) { + return [ + Forms\Components\TextInput::make('organism_parts'), + ]; + }), + // ->mountUsing( + // fn($record, $form) => $form->fill($record->pivot->toArray()) + // ), Tables\Actions\DetachAction::make(), ]) ->bulkActions([ diff --git a/app/Models/GeoLocation.php b/app/Models/GeoLocation.php index cd1aecaa..e4b2a018 100644 --- a/app/Models/GeoLocation.php +++ b/app/Models/GeoLocation.php @@ -20,6 +20,6 @@ class GeoLocation extends Model public function molecules() { - return $this->belongsToMany(Molecule::class)->withTimestamps(); + return $this->belongsToMany(Molecule::class)->withPivot('locations')->withTimestamps(); } } diff --git a/app/Models/Molecule.php b/app/Models/Molecule.php index f4d5fd85..c0af5786 100644 --- a/app/Models/Molecule.php +++ b/app/Models/Molecule.php @@ -102,12 +102,12 @@ public function collections(): BelongsToMany public function organisms() { - return $this->belongsToMany(Organism::class)->withTimestamps(); + return $this->belongsToMany(Organism::class)->withPivot('id','organism_parts')->withTimestamps(); } public function geoLocations() { - return $this->belongsToMany(GeoLocation::class)->withTimestamps(); + return $this->belongsToMany(GeoLocation::class)->withPivot('locations')->withTimestamps(); } /** diff --git a/app/Models/Organism.php b/app/Models/Organism.php index 0a27b031..8725f93b 100644 --- a/app/Models/Organism.php +++ b/app/Models/Organism.php @@ -20,6 +20,6 @@ class Organism extends Model public function molecules() { - return $this->belongsToMany(Molecule::class)->withTimestamps(); + return $this->belongsToMany(Molecule::class)->withPivot('id','organism_parts')->withTimestamps(); } } From 35d1d1dc927d74affae4bac77bf5acc5ec0ef476 Mon Sep 17 00:00:00 2001 From: Sagar Date: Thu, 25 Apr 2024 11:51:38 +0200 Subject: [PATCH 5/6] feat: generated policies for geolocation and organism --- app/Policies/GeoLocationPolicy.php | 108 +++++++++++++++++++++++++++++ app/Policies/OrganismPolicy.php | 108 +++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 app/Policies/GeoLocationPolicy.php create mode 100644 app/Policies/OrganismPolicy.php diff --git a/app/Policies/GeoLocationPolicy.php b/app/Policies/GeoLocationPolicy.php new file mode 100644 index 00000000..abaa6527 --- /dev/null +++ b/app/Policies/GeoLocationPolicy.php @@ -0,0 +1,108 @@ +can('view_any_geo::location'); + } + + /** + * Determine whether the user can view the model. + */ + public function view(User $user, GeoLocation $geoLocation): bool + { + return $user->can('view_geo::location'); + } + + /** + * Determine whether the user can create models. + */ + public function create(User $user): bool + { + return $user->can('create_geo::location'); + } + + /** + * Determine whether the user can update the model. + */ + public function update(User $user, GeoLocation $geoLocation): bool + { + return $user->can('update_geo::location'); + } + + /** + * Determine whether the user can delete the model. + */ + public function delete(User $user, GeoLocation $geoLocation): bool + { + return $user->can('delete_geo::location'); + } + + /** + * Determine whether the user can bulk delete. + */ + public function deleteAny(User $user): bool + { + return $user->can('delete_any_geo::location'); + } + + /** + * Determine whether the user can permanently delete. + */ + public function forceDelete(User $user, GeoLocation $geoLocation): bool + { + return $user->can('force_delete_geo::location'); + } + + /** + * Determine whether the user can permanently bulk delete. + */ + public function forceDeleteAny(User $user): bool + { + return $user->can('force_delete_any_geo::location'); + } + + /** + * Determine whether the user can restore. + */ + public function restore(User $user, GeoLocation $geoLocation): bool + { + return $user->can('restore_geo::location'); + } + + /** + * Determine whether the user can bulk restore. + */ + public function restoreAny(User $user): bool + { + return $user->can('restore_any_geo::location'); + } + + /** + * Determine whether the user can replicate. + */ + public function replicate(User $user, GeoLocation $geoLocation): bool + { + return $user->can('replicate_geo::location'); + } + + /** + * Determine whether the user can reorder. + */ + public function reorder(User $user): bool + { + return $user->can('reorder_geo::location'); + } +} diff --git a/app/Policies/OrganismPolicy.php b/app/Policies/OrganismPolicy.php new file mode 100644 index 00000000..587c7d5a --- /dev/null +++ b/app/Policies/OrganismPolicy.php @@ -0,0 +1,108 @@ +can('view_any_organism'); + } + + /** + * Determine whether the user can view the model. + */ + public function view(User $user, Organism $organism): bool + { + return $user->can('view_organism'); + } + + /** + * Determine whether the user can create models. + */ + public function create(User $user): bool + { + return $user->can('create_organism'); + } + + /** + * Determine whether the user can update the model. + */ + public function update(User $user, Organism $organism): bool + { + return $user->can('update_organism'); + } + + /** + * Determine whether the user can delete the model. + */ + public function delete(User $user, Organism $organism): bool + { + return $user->can('delete_organism'); + } + + /** + * Determine whether the user can bulk delete. + */ + public function deleteAny(User $user): bool + { + return $user->can('delete_any_organism'); + } + + /** + * Determine whether the user can permanently delete. + */ + public function forceDelete(User $user, Organism $organism): bool + { + return $user->can('force_delete_organism'); + } + + /** + * Determine whether the user can permanently bulk delete. + */ + public function forceDeleteAny(User $user): bool + { + return $user->can('force_delete_any_organism'); + } + + /** + * Determine whether the user can restore. + */ + public function restore(User $user, Organism $organism): bool + { + return $user->can('restore_organism'); + } + + /** + * Determine whether the user can bulk restore. + */ + public function restoreAny(User $user): bool + { + return $user->can('restore_any_organism'); + } + + /** + * Determine whether the user can replicate. + */ + public function replicate(User $user, Organism $organism): bool + { + return $user->can('replicate_organism'); + } + + /** + * Determine whether the user can reorder. + */ + public function reorder(User $user): bool + { + return $user->can('reorder_organism'); + } +} From aa4c86c980bc038f66032df5a1dfe134b6add6f7 Mon Sep 17 00:00:00 2001 From: Sagar Date: Thu, 25 Apr 2024 13:06:15 +0200 Subject: [PATCH 6/6] fix: gave view access to normal users for geolocations and organisms resources --- .../Dashboard/Resources/GeoLocationResource.php | 17 ----------------- .../OrganismsRelationManager.php | 4 ---- app/Policies/GeoLocationPolicy.php | 6 ++++-- app/Policies/OrganismPolicy.php | 6 ++++-- 4 files changed, 8 insertions(+), 25 deletions(-) diff --git a/app/Filament/Dashboard/Resources/GeoLocationResource.php b/app/Filament/Dashboard/Resources/GeoLocationResource.php index b376c3b7..8e69b1c6 100644 --- a/app/Filament/Dashboard/Resources/GeoLocationResource.php +++ b/app/Filament/Dashboard/Resources/GeoLocationResource.php @@ -32,23 +32,6 @@ public static function form(Form $form): Form TextInput::make('name') ->required() ->maxLength(255), - // Fieldset::make('Molecule') - // ->relationship('molecules', 'identifier') - // ->schema([ - // TextInput::make('identifier'), - // TextInput::make('locations'), - // ]) - // TextInput::make('molecule_id') - // ->label('Molecule') - // ->relationship('molecule') - // ->placeholder('Enter the molecule Identifier') - // ->required(), - // TextInput::make('locations') - // ->label('Locations') - // ->relationship('molecule') - // ->placeholder('soil, water, etc.') - // ->helperText('Enter where in this Geo-Location these molecules can be found') - // ->required(), ]); } diff --git a/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php index cdcc1594..f8484ce7 100644 --- a/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php +++ b/app/Filament/Dashboard/Resources/MoleculeResource/RelationManagers/OrganismsRelationManager.php @@ -36,7 +36,6 @@ public function table(Table $table): Table Tables\Columns\TextColumn::make('name'), Tables\Columns\TextColumn::make('organism_parts'), ]) - // ->allowDuplicates() ->filters([ // ]) @@ -55,9 +54,6 @@ public function table(Table $table): Table Forms\Components\TextInput::make('organism_parts'), ]; }), - // ->mountUsing( - // fn($record, $form) => $form->fill($record->pivot->toArray()) - // ), Tables\Actions\DetachAction::make(), ]) ->bulkActions([ diff --git a/app/Policies/GeoLocationPolicy.php b/app/Policies/GeoLocationPolicy.php index abaa6527..e0b81b07 100644 --- a/app/Policies/GeoLocationPolicy.php +++ b/app/Policies/GeoLocationPolicy.php @@ -15,7 +15,8 @@ class GeoLocationPolicy */ public function viewAny(User $user): bool { - return $user->can('view_any_geo::location'); + return true; + // return $user->can('view_any_geo::location'); } /** @@ -23,7 +24,8 @@ public function viewAny(User $user): bool */ public function view(User $user, GeoLocation $geoLocation): bool { - return $user->can('view_geo::location'); + return true; + // return $user->can('view_geo::location'); } /** diff --git a/app/Policies/OrganismPolicy.php b/app/Policies/OrganismPolicy.php index 587c7d5a..2ac37fd7 100644 --- a/app/Policies/OrganismPolicy.php +++ b/app/Policies/OrganismPolicy.php @@ -15,7 +15,8 @@ class OrganismPolicy */ public function viewAny(User $user): bool { - return $user->can('view_any_organism'); + return true; + // return $user->can('view_any_organism'); } /** @@ -23,7 +24,8 @@ public function viewAny(User $user): bool */ public function view(User $user, Organism $organism): bool { - return $user->can('view_organism'); + return true; + // return $user->can('view_organism'); } /**