-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from ARCANEDEV/update-package
Updating the package
- Loading branch information
Showing
9 changed files
with
74 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
<?php | ||
|
||
use Arcanedev\Breadcrumbs\Contracts\Breadcrumbs; | ||
|
||
if ( ! function_exists('breadcrumbs')) { | ||
/** | ||
* Get the Breadcrumb instance. | ||
* | ||
* @return \Arcanedev\Breadcrumbs\Contracts\Breadcrumbs | ||
*/ | ||
function breadcrumbs() { | ||
return app(Arcanedev\Breadcrumbs\Contracts\Breadcrumbs::class); | ||
function breadcrumbs(): Breadcrumbs { | ||
return app(Breadcrumbs::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
<?php namespace Arcanedev\Breadcrumbs; | ||
|
||
use Arcanedev\Support\PackageServiceProvider; | ||
use Arcanedev\Support\Providers\PackageServiceProvider; | ||
use Illuminate\Contracts\Support\DeferrableProvider; | ||
|
||
/** | ||
* Class BreadcrumbsServiceProvider | ||
* | ||
* @package Arcanedev\Breadcrumbs | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
class BreadcrumbsServiceProvider extends PackageServiceProvider | ||
class BreadcrumbsServiceProvider extends PackageServiceProvider implements DeferrableProvider | ||
{ | ||
/* ----------------------------------------------------------------- | ||
| Properties | ||
|
@@ -22,13 +23,6 @@ class BreadcrumbsServiceProvider extends PackageServiceProvider | |
*/ | ||
protected $package = 'breadcrumbs'; | ||
|
||
/** | ||
* Indicates if loading of the provider is deferred. | ||
* | ||
* @var bool | ||
*/ | ||
protected $defer = true; | ||
|
||
/* ----------------------------------------------------------------- | ||
| Main Methods | ||
| ----------------------------------------------------------------- | ||
|
@@ -37,22 +31,26 @@ class BreadcrumbsServiceProvider extends PackageServiceProvider | |
/** | ||
* Register the service provider. | ||
*/ | ||
public function register() | ||
public function register(): void | ||
{ | ||
parent::register(); | ||
|
||
$this->registerConfig(); | ||
$this->registerBreadcrumbsService(); | ||
|
||
// Register the Breadcrumbs service. | ||
$this->singleton(Contracts\Breadcrumbs::class, function ($app) { | ||
return new Breadcrumbs( | ||
$app['config']->get('breadcrumbs.template.supported', []), | ||
$app['config']->get('breadcrumbs.template.default', '') | ||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Boot the service provider. | ||
*/ | ||
public function boot() | ||
public function boot(): void | ||
{ | ||
parent::boot(); | ||
|
||
// Publishes | ||
$this->publishConfig(); | ||
$this->publishViews(); | ||
$this->publishTranslations(); | ||
|
@@ -63,31 +61,10 @@ public function boot() | |
* | ||
* @return array | ||
*/ | ||
public function provides() | ||
public function provides(): array | ||
{ | ||
return [ | ||
Contracts\Breadcrumbs::class, | ||
]; | ||
} | ||
|
||
/* ----------------------------------------------------------------- | ||
| Other Methods | ||
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
/** | ||
* Register the Breadcrumbs service. | ||
*/ | ||
private function registerBreadcrumbsService() | ||
{ | ||
$this->singleton(Contracts\Breadcrumbs::class, function ($app) { | ||
/** @var \Illuminate\Contracts\Config\Repository $config */ | ||
$config = $app['config']; | ||
|
||
return new Breadcrumbs( | ||
$config->get('breadcrumbs.template.supported', []), | ||
$config->get('breadcrumbs.template.default', '') | ||
); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters