Skip to content

Commit

Permalink
Merge pull request #23 from VGirol/patch-config
Browse files Browse the repository at this point in the history
Change config file name
  • Loading branch information
ianrobertsFF authored Jan 3, 2023
2 parents 914392d + edc0e5f commit 5304962
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ composer require formfeed-uk/nova-breadcrumbs
2) Publish the config file (optional)

```bash
php artisan vendor:publish --tag=breadcrumbs-config
php artisan vendor:publish --tag=nova-breadcrumbs-config
```

## Usage
Expand Down Expand Up @@ -155,8 +155,8 @@ The closure provided should return either an instance of Breadcrumb or an array

```php

use FormFeed\Breadcrumbs\Breadcrumbs;
use FormFeed\Breadcrumbs\Breadcrumb;
use FormFeed\Breadcrumbs\Breadcrumbs;

class NovaServiceProvider extends ServiceProvider {

Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions src/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public function shouldLinkToParent($resource) {
return $novaClass::$linkToParent;
}

if (!is_null(config("breadcrumbs.linkToParent"))) {
if (config("breadcrumbs.linkToParent") === true && $this->hasParentResource($resource)) {
if (!is_null(config("nova-breadcrumbs.linkToParent"))) {
if (config("nova-breadcrumbs.linkToParent") === true && $this->hasParentResource($resource)) {
return true;
}
}
Expand Down Expand Up @@ -142,11 +142,11 @@ public function getTabs(Resource $resource) {
}

protected static function label() {
return config("breadcrumbs.label", "label");
return config("nova-breadcrumbs.label", "label");
}

protected static function title() {
return config("breadcrumbs.title", "title");
return config("nova-breadcrumbs.title", "title");
}

public function getTabPreservedName($tab) {
Expand Down
4 changes: 2 additions & 2 deletions src/BreadcrumbServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public function boot() {
$this->addMiddleware();

$this->publishes([
__DIR__.'/../config/breadcrumbs.php' => config_path('breadcrumbs.php'),
], "breadcrumbs-config");
__DIR__.'/../config/nova-breadcrumbs.php' => config_path('nova-breadcrumbs.php'),
], "nova-breadcrumbs-config");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function groupBreadcrumb(NovaRequest $request, $resource) {
return Arr::wrap(call_user_func_array(static::$groupBreadcrumbCallback, [$request, $this, $groupBreadcrumb]));
}

if (config("breadcrumbs.includeGroup", false) === false || is_null($resource::group()) || ($resource::group() === "Other" && config("breadcrumbs.includeOtherGroup", false) !== true)) {
if (config("nova-breadcrumbs.includeGroup", false) === false || is_null($resource::group()) || ($resource::group() === "Other" && config("nova-breadcrumbs.includeOtherGroup", false) !== true)) {
return [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/InteractsWithParentResources.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function getParentResource(Resource $resource) {
}

protected function getParentMethod() {
return config("breadcrumbs.parentMethod", "parent");
return config("nova-breadcrumbs.parentMethod", "parent");
}

}
12 changes: 6 additions & 6 deletions src/Concerns/InteractsWithRelationships.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Formfeed\Breadcrumbs\Concerns;

use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Resource;
use Laravel\Nova\Fields\BelongsTo as BelongsToField;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\Relation;

use Laravel\Nova\Fields\BelongsTo as BelongsToField;
use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Resource;

use ReflectionClass;
use ReflectionMethod;
Expand All @@ -29,7 +29,7 @@ protected function relationshipsViaMethod($model) {
}

protected function relationshipsViaInvoke(Model|Null $model, Resource $resource) {
$invoke = (property_exists($resource::class, 'invokingReflection') ? $resource::class::$invokingReflection : config("breadcrumbs.invokingReflection", false)) ?? false;
$invoke = (property_exists($resource::class, 'invokingReflection') ? $resource::class::$invokingReflection : config("nova-breadcrumbs.invokingReflection", false)) ?? false;
if ($invoke !== true) {
return null;
}
Expand Down

0 comments on commit 5304962

Please sign in to comment.