diff --git a/src/DataTables/AbstractDataTable.php b/src/DataTables/AbstractDataTable.php index 4b4fc63b6cfd241cee3a829e6ee2d83fee895c78..1d3cf0a77329e5e8f4ee35db80b4cf27ce2f8349 100644 --- a/src/DataTables/AbstractDataTable.php +++ b/src/DataTables/AbstractDataTable.php @@ -117,7 +117,6 @@ abstract class AbstractDataTable extends BaseDataTable // 1. User is not a superadmin if (! $currentUser->isA('superadmin')) { - // 2. User can not list entities if (! $currentUser->can('list', $model)) { $query->whereNull($model->getKeyName()); @@ -126,12 +125,12 @@ abstract class AbstractDataTable extends BaseDataTable // 3. User can view only owned entities $currentUser->getAbilities()->whereNotNull('entity_type')->where(function ($ability) use ($morphMap) { return $ability->entity_type === $morphMap[$this->model] && $ability->name === 'view' && $ability->only_owned; - })->whenNotEmpty(fn() => $query->where('created_by_id', $currentUser->getAuthIdentifier())->where('created_by_type', $currentUser->getMorphClass())); + })->whenNotEmpty(fn () => $query->where('created_by_id', $currentUser->getAuthIdentifier())->where('created_by_type', $currentUser->getMorphClass())); // 4. User can view specific entities $currentUser->getAbilities()->whereNotNull('entity_type')->whereNotNull('entity_id')->where(function ($ability) use ($morphMap) { return $ability->entity_type === $morphMap[$this->model] && $ability->name === 'view' && ! $ability->only_owned; - })->pluck('entity_id')->whenNotEmpty(fn($entities) => $query->OrWhereIn($model->getKeyName(), $entities->toArray())); + })->pluck('entity_id')->whenNotEmpty(fn ($entities) => $query->OrWhereIn($model->getKeyName(), $entities->toArray())); } $selectedIds = collect($this->request()->input('selected_ids'))->filter(); diff --git a/src/Generators/LangJsGenerator.php b/src/Generators/LangJsGenerator.php index 8209a82412404ad23dc524270b7acc5c84192fd8..e13d0b6d216e52c003ef582ceba31d2d876918d5 100644 --- a/src/Generators/LangJsGenerator.php +++ b/src/Generators/LangJsGenerator.php @@ -31,7 +31,7 @@ class LangJsGenerator extends BaseLangJsGenerator foreach (array_merge(array_values(app('translation.loader')->namespaces()), [$this->sourcePath]) as $directory) { foreach ($this->file->allFiles($directory) as $file) { $path = mb_substr($file->getPath(), 0, mb_strrpos($file->getPath(), DIRECTORY_SEPARATOR)); - $namespace = collect(app('translation.loader')->namespaces())->search(fn($paths) => in_array($path, $paths)); + $namespace = collect(app('translation.loader')->namespaces())->search(fn ($paths) => in_array($path, $paths)); $pathName = $file->getRelativePathName(); $extension = $file->getExtension();