Skip to content

Commit

Permalink
Implement Adapater and Additional Facade (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmichael123 authored Apr 27, 2021
1 parent 92673e5 commit df71fb3
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 4 deletions.
50 changes: 50 additions & 0 deletions src/Facades/Image.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace Meema\LaravelMeema\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @method static function w($value)
* @method static function h($value)
* @method static function q($value)
* @method static function blur($value)
* @method static function nsfw($value)
* @method static function bg($value)
* @method static function ar($value)
* @method static function br($value)
* @method static function hue($value)
* @method static function sat($value)
* @method static function sharp($value)
* @method static function pad($value)
* @method static function greyscale($value)
* @method static function trim($value)
* @method static function faceindex($value)
* @method static function fillColor($value)
* @method static function fill($value)
* @method static function cs($value)
* @method static function dpr($value)
* @method static function extend($value)
* @method static function extract($value)
* @method static function crop($value)
* @method static function maxH($value)
* @method static function minH($value)
* @method static function maxW($value)
* @method static function minW($value)
* @method static function fit($value)
* @method static function px($value)
*
* @see \Meema\MeemaClient\Functions\Image
*/
class Image extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'meema-image';
}
}
4 changes: 2 additions & 2 deletions src/Facades/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
* @method static function makePrivate($ids)
* @method static function makePublic($ids)
* @method static function duplicate($ids)
* @method static folders($id = null)
* @method static tags($id = null)
* @method static function folders($id = null)
* @method static function tags($id = null)
* @method static function getId()
*
* @see \Meema\MeemaClient\Models\Media
Expand Down
29 changes: 29 additions & 0 deletions src/Facades/Video.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Meema\LaravelMeema\Facades;

use Illuminate\Support\Facades\Facade;

/**
* @method static function thumbnails($value)
* @method static function hls($value)
* @method static function dash($value)
* @method static function poster($value)
* @method static function webvtt($value)
* @method static function format($value)
* @method static function webOptimized($value)
*
* @see \Meema\MeemaClient\Functions\Video
*/
class Video extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'meema-video';
}
}
22 changes: 20 additions & 2 deletions src/Providers/MeemaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function boot()

Storage::extend('meema', function ($app, $config) {
$client = new MeemaClient(
$config['meema_api_key']
$config['meema.secret_api_key']
);

return new Filesystem(new MeemaAdapter($client));
Expand All @@ -37,6 +37,18 @@ public function register()
{
$this->registerMeemaClient();

$this->bindModels();

$this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'meema');
}

/**
* Registers the Meema SDK Client Models.
*
* @return void
*/
public function bindModels()
{
$this->app->bind('meema-media', function ($app) {
return $app['meema']->media();
});
Expand All @@ -53,7 +65,13 @@ public function register()
return $app['meema']->favorites();
});

$this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'meema');
$this->app->bind('meema-image', function ($app) {
return $app['meema']->image();
});

$this->app->bind('meema-video', function ($app) {
return $app['meema']->video();
});
}

/**
Expand Down

0 comments on commit df71fb3

Please sign in to comment.