I'm using the laravel-elfinder package (https://github.com/barryvdh/laravel-elfinder).
My aim is to automatically resize and copy any uploaded images so I can so they can be served responsively.
Given the standard Elfinder package, you can bind methods to actions e.g.: https://github.com/Studio-42/elFinder/wiki/Logging#using-class-instance-callback
However, in this example the elFinderSimpleLogger class is initialised in the Connector file. Using laravel-elfinder, this file resides in the vendor directory so I don't want to change it.
The $opts array is available in the packages config file (config/elfinder.php) and in there I've tried to reference the new class:
'bind' => array(
'upload' => array(new App\Classes\elFinderSimpleLogger(public_path('log.txt')), 'log')
),
But this doesn't work. So I then created a ServiceProvider to try and make the method available:
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class CustomElfinderServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->app->singleton('App\Classes\elFinderSimpleLogger', function () {
return new \App\Classes\elFinderSimpleLogger(public_path('log.txt'));
});
}
}
but I have no luck here.
Should I be trying to override the whole controller or can I just extend the controller to provide a new method?
Thanks.