Skip to content

Commit 54864d5

Browse files
author
SteeinSource
committed
Support Laravel
1 parent 88fc41a commit 54864d5

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

src/Laravel/RobotsFacade.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
namespace Steein\Robots\Laravel;
3+
4+
use Illuminate\Support\Facades\Facade;
5+
6+
class RobotsFacade extends Facade
7+
{
8+
/**
9+
* Get the registered name of the component.
10+
*
11+
* @return string
12+
*/
13+
protected static function getFacadeAccessor() { return 'robots'; }
14+
}

src/Laravel/RobotsServiceProvider.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
namespace Steein\Robots\Laravel;
3+
4+
use Illuminate\Support\ServiceProvider;
5+
use Steein\Robots\Robots;
6+
7+
class RobotsServiceProvider extends ServiceProvider
8+
{
9+
/**
10+
* Indicates if loading of the provider is deferred.
11+
*
12+
* @var bool
13+
*/
14+
protected $defer = false;
15+
16+
/**
17+
* Bootstrap the application events.
18+
*
19+
* @return void
20+
*/
21+
public function boot()
22+
{
23+
$this->package('steein/robots');
24+
}
25+
26+
/**
27+
* Register the service provider.
28+
*
29+
* @return void
30+
*/
31+
public function register()
32+
{
33+
$this->app['robots'] = $this->app->share(function($app)
34+
{
35+
return new Robots();
36+
});
37+
38+
$this->app->booting(function()
39+
{
40+
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
41+
$loader->alias('Robots', 'Steein\Robots\Laravel\RobotsFacade');
42+
});
43+
}
44+
45+
}

0 commit comments

Comments
 (0)