Initial commit

This commit is contained in:
Gertjan Krol 2022-08-20 01:16:00 +02:00
commit ffb400fb95
20 changed files with 442 additions and 0 deletions

View file

@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace Crawl\Skeleton;
use Illuminate\Support\ServiceProvider;
class SkeletonServiceProvider extends ServiceProvider
{
public const PACKAGE_VENDOR = 'crawl';
public const PACKAGE_NAME = 'skeleton';
private const COMMANDS = [
];
/**
* Bootstrap the application services.
*/
public function boot(): void
{
// Optional methods to load package assets
//$this->loadMigrationsFrom($this->getPackagePath() . '/database/migrations');
//$this->loadRoutesFrom($this->getPackagePath() . '/routes.php');
//$this->loadTranslationsFrom($this->getPackagePath() . '/resources/lang', self::PACKAGE_NAME);
//$this->loadViewsFrom($this->getPackagePath() . '/resources/views', self::PACKAGE_NAME);
if ($this->app->runningInConsole()) {
// Publish config
$this->publishes([
$this->getPackagePath() . '/config/config.php' => config_path(self::PACKAGE_NAME . '.php'),
], 'config');
// Publish assets
//$this->publishes([
// $this->getPackagePath() . '/resources/assets' => public_path('vendor/' . self::PACKAGE_NAME),
//], ['assets', 'public']);
// Publishing translation files
//$this->publishes([
// $this->getPackagePath() . '/resources/lang' => resource_path('lang/vendor/' . self::PACKAGE_NAME),
//], 'lang');
// Publishing views
//$this->publishes([
// $this->getPackagePath() . '/resources/views' => resource_path('views/vendor/' . self::PACKAGE_NAME),
//], 'views');
// Registering package commands
$this->commands(self::COMMANDS);
}
}
/**
* Register the application services.
*/
public function register(): void
{
// Automatically apply the package configuration
$this->mergeConfigFrom($this->getPackagePath() . '/config/config.php', self::PACKAGE_NAME);
// Register the main class to use with the facade
$this->app->singleton(self::PACKAGE_NAME, static function () {
return new Skeleton();
});
}
private function getPackagePath(): string
{
return realpath(__DIR__ . '/..');
}
}