Skip to content

Commit

Permalink
第一个版本
Browse files Browse the repository at this point in the history
  • Loading branch information
dairidong committed Dec 24, 2020
1 parent 6b4a41c commit 9e113f9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,12 @@
"require-dev": {
"phpunit/phpunit": "^9.5",
"mockery/mockery": "^1.4"
},
"extra": {
"laravel": {
"providers": [
"Jat\\Weather\\ServiceProvider"
]
}
}
}
24 changes: 24 additions & 0 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php


namespace Jat\Weather;


class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
protected $defer = true;

public function register()
{
$this->app->singleton(Weather::class, function () {
return new Weather(config('services.weather.key'));
});

$this->app->alias(Weather::class, 'weather');
}

public function provides()
{
return [Weather::class, 'weather'];
}
}

0 comments on commit 9e113f9

Please sign in to comment.