ReviewOS

also looking at this

meemalabs/laravel-meema

Initial Progress

#2
Merged glennmichael123 wants to merge initial-progress into main
11 files +235 -34
src/Providers/MeemaServiceProvider.phpadded+59-0
Changes to src/Providers/MeemaServiceProvider.php
@@ -0,0 +1,59 @@
1<?php
2
3namespace Meema\LaravelMeema\Providers;
4
5use Illuminate\Support\ServiceProvider;
6use Meema\MeemaApi\Client;
7
8class MeemaServiceProvider extends ServiceProvider
9{
10 /**
11 * Bootstrap the application services.
12 */
13 public function boot()
14 {
15 if ($this->app->runningInConsole()) {
16 $this->publishes([
17 __DIR__.'/../../config/config.php' => config_path('meema.php'),
18 ], 'config');
19 }
20 }
21
22 /**
23 * Register the application services.
24 */
25 public function register()
26 {
27 $this->registerMeemaClient();
28
29 $this->app->bind('meema-media', function ($app) {
30 return $app['meema']->media();
31 });
32
33 $this->app->bind('meema-folder', function ($app) {
34 return $app['meema']->folders();
35 });
36
37 $this->app->bind('meema-tag', function ($app) {
38 return $app['meema']->tags();
39 });
40
41 $this->app->bind('meema-favorite', function ($app) {
42 return $app['meema']->favorite();
43 });
44
45 $this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'meema');
46 }
47
48 /**
49 * Registers the Meema SDK Client.
50 *
51 * @return void
52 */
53 protected function registerMeemaClient()
54 {
55 $this->app->singleton('meema', function ($app) {
56 return new Client(config('meema.api_key'));
57 });
58 }
59}