Commit ae84b344 authored by nirgendswo's avatar nirgendswo

delete services

bugfix parameters
parent 1842160d
......@@ -29,7 +29,7 @@ class ImageHelper
$this->save($image, $destinationPath);
}
return config('app.mediaPublicPath').'/'.$destinationPath;
return $this->getPublicFilePathname($destinationPath);
}
/**
......@@ -50,7 +50,7 @@ class ImageHelper
$this->save($image, $destinationPath);
}
return config('app.mediaPublicPath').'/'.$destinationPath;
return $this->getPublicFilePathname($destinationPath);
}
/**
......@@ -70,7 +70,7 @@ class ImageHelper
$this->save($image, $destinationPath);
}
return config('app.mediaPublicPath').'/'.$destinationPath;
return $this->getPublicFilePathname($destinationPath);
}
/**
......@@ -90,7 +90,7 @@ class ImageHelper
$this->save($image, $destinationPath);
}
return config('app.mediaPublicPath').'/'.$destinationPath;
return $this->getPublicFilePathname($destinationPath);
}
/**
......@@ -117,6 +117,18 @@ class ImageHelper
return preg_replace('/(\.[^.]+)$/', sprintf('%s$1', '_'.$suffix), $filePathname);
}
/**
* adding suffix to filename
*
* @param string $filePathname
* @param string $suffix
* @return string
*/
protected function getPublicFilePathname($filePathname)
{
return '/'.config('app.mediaPublicPath').'/'.$filePathname;
}
/**
* if file not found create ImageResize
*
......
......@@ -3,7 +3,13 @@
namespace App\Http\Middleware;
use Closure;
use App\PageService;
/**
* Create PageService
*
* @author Björn Hase
*/
class Parameters
{
/**
......@@ -15,7 +21,7 @@ class Parameters
*/
public function handle($request, Closure $next)
{
$pageService = app(\App\PageService::class);
$pageService = app(PageService::class);
return $next($request);
}
}
......@@ -13,6 +13,20 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
$this->loadTranslationsFrom(base_path().'/bresources/lang', 'date');
$this->app->bind('App\ImageHelper', function() {
return new \App\Helpers\ImageHelper();
});
$this->app->bind('App\ViewHelper', function() {
return new \App\Helpers\ViewHelper();
});
$this->app->bind('App\PageParser', function() {
return new \App\Parsers\PageParser();
});
$this->app->bind('App\PageRepository', function() {
return new \App\Repositories\PageRepository();
});
}
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\App;
class ImageHelperServiceProvider extends ServiceProvider
{
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind('App\ImageHelper', function() {
return new \App\Helpers\ImageHelper();
});
}
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\App;
class PageParserServiceProvider extends ServiceProvider
{
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind('App\PageParser', function() {
return new \App\Parsers\PageParser();
});
}
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\App;
class PageRepositoryServiceProvider extends ServiceProvider
{
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind('App\PageRepository', function() {
return new \App\Repositories\PageRepository();
});
}
}
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\App;
class ViewHelperServiceProvider extends ServiceProvider
{
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind('App\ViewHelper', function() {
return new \App\Helpers\ViewHelper();
});
}
}
......@@ -45,6 +45,8 @@ class PageService {
// adding to path a '/'
if ($this->slug === '/') {
$this->slug = '';
} else {
$this->slug = '/'.$this->slug;
}
$this->handlePage($this->slug);
......
......@@ -80,10 +80,7 @@ $app->routeMiddleware([
|
*/
$app->register(App\Providers\PageRepositoryServiceProvider::class);
$app->register(App\Providers\PageParserServiceProvider::class);
$app->register(App\Providers\ViewHelperServiceProvider::class);
$app->register(App\Providers\ImageHelperServiceProvider::class);
$app->register(App\Providers\AppServiceProvider::class);
/*
|--------------------------------------------------------------------------
......
@if ($pageRepository->getCount() > 1)
<div class="pagination">
@for ($i = 1; $i <= $pageRepository->getCount(); $i++)
<a class="pagination__item" href="p/{{ $i }}">
<a class="pagination__item" href="/p/{{ $i }}">
{{ $i }}
</a>
@endfor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment