2017-10-03 17:05:46 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Meoran\Images\Providers;
|
|
|
|
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
use Intervention\Image\ImageServiceProvider;
|
|
|
|
use Spatie\LaravelImageOptimizer\ImageOptimizerServiceProvider;
|
|
|
|
|
|
|
|
class ImagesServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
|
|
|
|
public function boot()
|
|
|
|
{
|
|
|
|
require_once __DIR__ . '/../functions.php';
|
|
|
|
|
|
|
|
$this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
|
|
|
|
$this->mergeConfigFrom(__DIR__ . '/../../config/image.php', 'image');
|
|
|
|
|
|
|
|
|
|
|
|
$this->app->register(ImageServiceProvider::class);
|
|
|
|
$this->app->register(ImageOptimizerServiceProvider::class);
|
|
|
|
|
|
|
|
$this->loadRoutes();
|
|
|
|
|
|
|
|
if ($this->app->runningInConsole()) {
|
|
|
|
$this->publishes([
|
|
|
|
// __DIR__ . '/../../config/synchronize.php' => base_path('config/synchronize.php')
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function loadRoutes()
|
|
|
|
{
|
2017-10-03 17:11:49 +02:00
|
|
|
$this->app->post('images/upload', [
|
2017-10-03 17:05:46 +02:00
|
|
|
'as' => 'uploadImage', 'uses' => '\Meoran\Images\Http\Controllers\ImagesController@upload'
|
|
|
|
]);
|
|
|
|
|
2017-10-04 16:46:56 +02:00
|
|
|
$this->app->get('images/{filename}[/{template}]', [
|
2017-10-03 17:05:46 +02:00
|
|
|
'as' => 'getPicture', 'uses' => '\Meoran\Images\Http\Controllers\ImagesController@get'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|