Skip to content

Commit

Permalink
feat: add support for laravel 8
Browse files Browse the repository at this point in the history
Based on brozot#217
  • Loading branch information
tszulc committed Sep 5, 2023
1 parent 989cbd6 commit 9a02ecf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
}
],
"require": {
"php": "^7.2.5",
"illuminate/support": "^6.0|^7.0",
"php": "^7.2.5|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0",
"guzzlehttp/guzzle": "^6.3|^7.0",
"monolog/monolog": "^1.12|^2.0"
},
"require-dev": {
"mockery/mockery" : "^1.3.1",
"phpunit/phpunit" : "^8.4|^9.3",
"laravel/laravel": "^6.0|^7.0",
"mockery/mockery" : "^1.3.1|^1.4.4",
"phpunit/phpunit" : "^8.4|^9.3|^9.5",
"laravel/laravel": "^6.0|^7.0|^8.0",
"php-coveralls/php-coveralls": "^2.0"
},
"autoload": {
Expand Down
20 changes: 18 additions & 2 deletions src/FCMManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,29 @@ class FCMManager extends Manager
{
public function getDefaultDriver()
{
return $this->app[ 'config' ][ 'fcm.driver' ];
return $this->getContainer()[ 'config' ][ 'fcm.driver' ];
}

protected function createHttpDriver()
{
$config = $this->app[ 'config' ]->get('fcm.http', []);
$config = $this->getContainer()[ 'config' ]->get('fcm.http', []);

return new Client(['timeout' => $config[ 'timeout' ]]);
}

/**
* Get the app container
*
* @return \Illuminate\Contracts\Container\Container
*/
public function getContainer()
{
// Laravel 7.x, 8.x support
if (isset($this->container)) {
return $this->container;
}

// "app" Does not exist anymore in 8.x
return $this->app;
}
}

0 comments on commit 9a02ecf

Please sign in to comment.