CS: PSR1/2

parent b4d1ad30
...@@ -51,7 +51,6 @@ class ConfigureDatabase implements SetupScript ...@@ -51,7 +51,6 @@ class ConfigureDatabase implements SetupScript
$vars = []; $vars = [];
while (! $connected) { while (! $connected) {
$vars['db_driver'] = $this->askDatabaseDriver(); $vars['db_driver'] = $this->askDatabaseDriver();
$vars['db_host'] = $this->askDatabaseHost(); $vars['db_host'] = $this->askDatabaseHost();
$vars['db_port'] = $this->askDatabasePort($vars['db_driver']); $vars['db_port'] = $this->askDatabasePort($vars['db_driver']);
...@@ -158,7 +157,7 @@ class ConfigureDatabase implements SetupScript ...@@ -158,7 +157,7 @@ class ConfigureDatabase implements SetupScript
$this->config['database.connections.' . $driver . '.database'] = $vars['db_database']; $this->config['database.connections.' . $driver . '.database'] = $vars['db_database'];
$this->config['database.connections.' . $driver . '.username'] = $vars['db_username']; $this->config['database.connections.' . $driver . '.username'] = $vars['db_username'];
$this->config['database.connections.' . $driver . '.password'] = $vars['db_password']; $this->config['database.connections.' . $driver . '.password'] = $vars['db_password'];
app(DatabaseManager::class)->purge($driver); app(DatabaseManager::class)->purge($driver);
app(ConnectionFactory::class)->make($this->config['database.connections.' . $driver], $driver); app(ConnectionFactory::class)->make($this->config['database.connections.' . $driver], $driver);
} }
...@@ -177,4 +176,4 @@ class ConfigureDatabase implements SetupScript ...@@ -177,4 +176,4 @@ class ConfigureDatabase implements SetupScript
return false; return false;
} }
} }
} }
\ No newline at end of file
...@@ -6,10 +6,8 @@ use Illuminate\Console\Command; ...@@ -6,10 +6,8 @@ use Illuminate\Console\Command;
use Modules\Core\Console\Installers\SetupScript; use Modules\Core\Console\Installers\SetupScript;
use Modules\Core\Console\Installers\Writers\EnvFileWriter; use Modules\Core\Console\Installers\Writers\EnvFileWriter;
class CreateEnvFile implements SetupScript class CreateEnvFile implements SetupScript
{ {
/** /**
* @var EnvFileWriter * @var EnvFileWriter
*/ */
...@@ -42,8 +40,4 @@ class CreateEnvFile implements SetupScript ...@@ -42,8 +40,4 @@ class CreateEnvFile implements SetupScript
$command->info('Successfully created .env file'); $command->info('Successfully created .env file');
} }
} }
...@@ -25,7 +25,6 @@ class SetInstalledFlag implements SetupScript ...@@ -25,7 +25,6 @@ class SetInstalledFlag implements SetupScript
*/ */
public function fire(Command $command) public function fire(Command $command)
{ {
$vars = []; $vars = [];
$vars['installed'] = 'true'; $vars['installed'] = 'true';
...@@ -33,6 +32,5 @@ class SetInstalledFlag implements SetupScript ...@@ -33,6 +32,5 @@ class SetInstalledFlag implements SetupScript
$this->env->write($vars); $this->env->write($vars);
$command->info('The application is now installed'); $command->info('The application is now installed');
} }
} }
\ No newline at end of file
...@@ -68,26 +68,19 @@ class EnvFileWriter ...@@ -68,26 +68,19 @@ class EnvFileWriter
public function write($vars) public function write($vars)
{ {
if (!empty($vars)) { if (!empty($vars)) {
$environmentFile = $this->finder->get($this->file); $environmentFile = $this->finder->get($this->file);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (isset($this->setable_variables[$key])) { if (isset($this->setable_variables[$key])) {
$env_var_name = explode('=', $this->setable_variables[$key])[0]; $env_var_name = explode('=', $this->setable_variables[$key])[0];
$value = $env_var_name . '=' . $value; $value = $env_var_name . '=' . $value;
$environmentFile = str_replace($this->setable_variables[$key], $value, $environmentFile); $environmentFile = str_replace($this->setable_variables[$key], $value, $environmentFile);
} }
} }
$this->finder->put($this->file, $environmentFile); $this->finder->put($this->file, $environmentFile);
} }
} }
} }
\ No newline at end of file
...@@ -98,8 +98,10 @@ trait Translatable ...@@ -98,8 +98,10 @@ trait Translatable
$cacheArray = []; $cacheArray = [];
$translatedEntityName = $this->getTranslationClass(); $translatedEntityName = $this->getTranslationClass();
if (! isset($cacheArray[$translatedEntityName])) { if (! isset($cacheArray[$translatedEntityName])) {
$cacheArray[$translatedEntityName] = array_values(array_diff(EntityManagerFacade::getClassMetadata($translatedEntityName)->getColumnNames(), $cacheArray[$translatedEntityName] = array_values(array_diff(
['id', 'locale'])); EntityManagerFacade::getClassMetadata($translatedEntityName)->getColumnNames(),
['id', 'locale']
));
} }
return $cacheArray[$translatedEntityName]; return $cacheArray[$translatedEntityName];
......
...@@ -67,7 +67,10 @@ abstract class BaseFormRequest extends FormRequest ...@@ -67,7 +67,10 @@ abstract class BaseFormRequest extends FormRequest
} }
return $factory->make( return $factory->make(
$this->all(), $rules, array_merge($this->messages(), $messages), $attributes $this->all(),
$rules,
array_merge($this->messages(), $messages),
$attributes
); );
} }
......
...@@ -262,7 +262,9 @@ class CoreServiceProvider extends ServiceProvider ...@@ -262,7 +262,9 @@ class CoreServiceProvider extends ServiceProvider
$localeConfig = $this->app['cache'] $localeConfig = $this->app['cache']
->tags('setting.settings', 'global') ->tags('setting.settings', 'global')
->remember("asgard.locales", 120, ->remember(
"asgard.locales",
120,
function () { function () {
return DB::table('setting__settings')->whereName('core::locales')->first(); return DB::table('setting__settings')->whereName('core::locales')->first();
} }
......
...@@ -45,7 +45,9 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -45,7 +45,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.find.{$id}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.find.{$id}",
$this->cacheTime,
function () use ($id) { function () use ($id) {
return $this->repository->find($id); return $this->repository->find($id);
} }
...@@ -59,7 +61,9 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -59,7 +61,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.all", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.all",
$this->cacheTime,
function () { function () {
return $this->repository->all(); return $this->repository->all();
} }
...@@ -73,7 +77,9 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -73,7 +77,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allWithBuilder", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.allWithBuilder",
$this->cacheTime,
function () { function () {
return $this->repository->allWithBuilder(); return $this->repository->allWithBuilder();
} }
...@@ -87,7 +93,9 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -87,7 +93,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.paginate.{$perPage}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.paginate.{$perPage}",
$this->cacheTime,
function () use ($perPage) { function () use ($perPage) {
return $this->repository->paginate($perPage); return $this->repository->paginate($perPage);
} }
...@@ -101,7 +109,9 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -101,7 +109,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allTranslatedIn.{$lang}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.allTranslatedIn.{$lang}",
$this->cacheTime,
function () use ($lang) { function () use ($lang) {
return $this->repository->allTranslatedIn($lang); return $this->repository->allTranslatedIn($lang);
} }
...@@ -115,7 +125,9 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -115,7 +125,9 @@ abstract class BaseCacheDecorator implements BaseRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findBySlug.{$slug}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findBySlug.{$slug}",
$this->cacheTime,
function () use ($slug) { function () use ($slug) {
return $this->repository->findBySlug($slug); return $this->repository->findBySlug($slug);
} }
...@@ -161,7 +173,9 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -161,7 +173,9 @@ abstract class BaseCacheDecorator implements BaseRepository
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByAttributes.{$tagIdentifier}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findByAttributes.{$tagIdentifier}",
$this->cacheTime,
function () use ($attributes) { function () use ($attributes) {
return $this->repository->findByAttributes($attributes); return $this->repository->findByAttributes($attributes);
} }
...@@ -177,7 +191,9 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -177,7 +191,9 @@ abstract class BaseCacheDecorator implements BaseRepository
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByAttributes.{$tagIdentifier}.{$orderBy}.{$sortOrder}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findByAttributes.{$tagIdentifier}.{$orderBy}.{$sortOrder}",
$this->cacheTime,
function () use ($attributes, $orderBy, $sortOrder) { function () use ($attributes, $orderBy, $sortOrder) {
return $this->repository->getByAttributes($attributes, $orderBy, $sortOrder); return $this->repository->getByAttributes($attributes, $orderBy, $sortOrder);
} }
...@@ -193,7 +209,9 @@ abstract class BaseCacheDecorator implements BaseRepository ...@@ -193,7 +209,9 @@ abstract class BaseCacheDecorator implements BaseRepository
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByMany.{$tagIdentifier}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findByMany.{$tagIdentifier}",
$this->cacheTime,
function () use ($ids) { function () use ($ids) {
return $this->repository->findByMany($ids); return $this->repository->findByMany($ids);
} }
......
...@@ -23,7 +23,9 @@ class CacheWidgetDecorator extends BaseCacheDecorator implements WidgetRepositor ...@@ -23,7 +23,9 @@ class CacheWidgetDecorator extends BaseCacheDecorator implements WidgetRepositor
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findForUser.{$userId}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findForUser.{$userId}",
$this->cacheTime,
function () use ($userId) { function () use ($userId) {
return $this->repository->findForUser($userId); return $this->repository->findForUser($userId);
} }
...@@ -40,7 +42,9 @@ class CacheWidgetDecorator extends BaseCacheDecorator implements WidgetRepositor ...@@ -40,7 +42,9 @@ class CacheWidgetDecorator extends BaseCacheDecorator implements WidgetRepositor
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.updateOrCreateForUser.{$userId}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.updateOrCreateForUser.{$userId}",
$this->cacheTime,
function () use ($widgets, $userId) { function () use ($widgets, $userId) {
return $this->repository->updateOrCreateForUser($widgets, $userId); return $this->repository->updateOrCreateForUser($widgets, $userId);
} }
......
<?php <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFoldersColumnsOnFilesTable extends Migration class AddFoldersColumnsOnFilesTable extends Migration
{ {
......
...@@ -257,13 +257,13 @@ class Imagy ...@@ -257,13 +257,13 @@ class Imagy
} }
$filenameWithoutPrefix = $this->removeConfigPrefix($path->getRelativeUrl()); $filenameWithoutPrefix = $this->removeConfigPrefix($path->getRelativeUrl());
$filename = substr(strrchr($filenameWithoutPrefix, '/'), 1); $filename = substr(strrchr($filenameWithoutPrefix, '/'), 1);
$folders = str_replace($filename, '' , $filenameWithoutPrefix); $folders = str_replace($filename, '', $filenameWithoutPrefix);
if ($filename === false) { if ($filename === false) {
return config('asgard.media.config.files-path') . $this->newFilename($path, $thumbnail); return config('asgard.media.config.files-path') . $this->newFilename($path, $thumbnail);
} }
return config('asgard.media.config.files-path') . $folders . $this->newFilename($path, $thumbnail); return config('asgard.media.config.files-path') . $folders . $this->newFilename($path, $thumbnail);
} }
/** /**
...@@ -276,7 +276,7 @@ class Imagy ...@@ -276,7 +276,7 @@ class Imagy
return str_replace([ return str_replace([
$configAssetPath, $configAssetPath,
ltrim($configAssetPath, '/') ltrim($configAssetPath, '/'),
], '', $path); ], '', $path);
} }
} }
...@@ -40,8 +40,8 @@ final class EloquentFolderRepositoryTest extends MediaTestCase ...@@ -40,8 +40,8 @@ final class EloquentFolderRepositoryTest extends MediaTestCase
$this->assertCount(1, $this->folder->all()); $this->assertCount(1, $this->folder->all());
$this->assertEquals('My Folder', $folder->filename); $this->assertEquals('My Folder', $folder->filename);
$this->assertEquals('/assets/media/my-folder', $folder->path->getRelativeUrl()); $this->assertEquals('/assets/media/my-folder', $folder->path->getRelativeUrl());
$this->assertTrue( $folder->is_folder); $this->assertTrue($folder->is_folder);
$this->assertTrue( $folder->isFolder()); $this->assertTrue($folder->isFolder());
$this->assertEquals(0, $folder->folder_id); $this->assertEquals(0, $folder->folder_id);
} }
......
...@@ -31,8 +31,8 @@ class MediaTransformer extends Resource ...@@ -31,8 +31,8 @@ class MediaTransformer extends Resource
'media_type' => $this->media_type, 'media_type' => $this->media_type,
'fa_icon' => FileHelper::getFaIcon($this->media_type), 'fa_icon' => FileHelper::getFaIcon($this->media_type),
'created_at' => $this->created_at, 'created_at' => $this->created_at,
'small_thumb' => $this->imagy->getThumbnail($this->path,'smallThumb'), 'small_thumb' => $this->imagy->getThumbnail($this->path, 'smallThumb'),
'medium_thumb' => $this->imagy->getThumbnail($this->path,'mediumThumb'), 'medium_thumb' => $this->imagy->getThumbnail($this->path, 'mediumThumb'),
]; ];
} }
......
...@@ -27,7 +27,9 @@ class CacheMenuDecorator extends BaseCacheDecorator implements MenuRepository ...@@ -27,7 +27,9 @@ class CacheMenuDecorator extends BaseCacheDecorator implements MenuRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allOnline", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.allOnline",
$this->cacheTime,
function () { function () {
return $this->repository->allOnline(); return $this->repository->allOnline();
} }
......
...@@ -29,7 +29,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos ...@@ -29,7 +29,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.rootsForMenu.{$menuId}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.rootsForMenu.{$menuId}",
$this->cacheTime,
function () use ($menuId) { function () use ($menuId) {
return $this->repository->rootsForMenu($menuId); return $this->repository->rootsForMenu($menuId);
} }
...@@ -45,7 +47,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos ...@@ -45,7 +47,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.getForRoutes", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.getForRoutes",
$this->cacheTime,
function () { function () {
return $this->repository->getForRoutes(); return $this->repository->getForRoutes();
} }
...@@ -62,7 +66,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos ...@@ -62,7 +66,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.getRootForMenu.{$menuId}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.getRootForMenu.{$menuId}",
$this->cacheTime,
function () use ($menuId) { function () use ($menuId) {
return $this->repository->getRootForMenu($menuId); return $this->repository->getRootForMenu($menuId);
} }
...@@ -79,7 +85,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos ...@@ -79,7 +85,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.getTreeForMenu.{$menuId}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.getTreeForMenu.{$menuId}",
$this->cacheTime,
function () use ($menuId) { function () use ($menuId) {
return $this->repository->getTreeForMenu($menuId); return $this->repository->getTreeForMenu($menuId);
} }
...@@ -96,7 +104,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos ...@@ -96,7 +104,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allRootsForMenu.{$menuId}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.allRootsForMenu.{$menuId}",
$this->cacheTime,
function () use ($menuId) { function () use ($menuId) {
return $this->repository->allRootsForMenu($menuId); return $this->repository->allRootsForMenu($menuId);
} }
...@@ -112,7 +122,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos ...@@ -112,7 +122,9 @@ class CacheMenuItemDecorator extends BaseCacheDecorator implements MenuItemRepos
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByUriInLanguage.{$uri}.{$locale}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findByUriInLanguage.{$uri}.{$locale}",
$this->cacheTime,
function () use ($uri, $locale) { function () use ($uri, $locale) {
return $this->repository->findByUriInLanguage($uri, $locale); return $this->repository->findByUriInLanguage($uri, $locale);
} }
......
...@@ -31,7 +31,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository ...@@ -31,7 +31,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findHomepage", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findHomepage",
$this->cacheTime,
function () { function () {
return $this->repository->findHomepage(); return $this->repository->findHomepage();
} }
...@@ -46,7 +48,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository ...@@ -46,7 +48,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.countAll", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.countAll",
$this->cacheTime,
function () { function () {
return $this->repository->countAll(); return $this->repository->countAll();
} }
...@@ -62,7 +66,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository ...@@ -62,7 +66,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findBySlugInLocale.{$slug}.{$locale}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findBySlugInLocale.{$slug}.{$locale}",
$this->cacheTime,
function () use ($slug, $locale) { function () use ($slug, $locale) {
return $this->repository->findBySlugInLocale($slug, $locale); return $this->repository->findBySlugInLocale($slug, $locale);
} }
...@@ -85,7 +91,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository ...@@ -85,7 +91,9 @@ class CachePageDecorator extends BaseCacheDecorator implements PageRepository
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.serverPaginationFilteringFor.{$key}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.serverPaginationFilteringFor.{$key}",
$this->cacheTime,
function () use ($request) { function () use ($request) {
return $this->repository->serverPaginationFilteringFor($request); return $this->repository->serverPaginationFilteringFor($request);
} }
......
...@@ -58,7 +58,9 @@ class SettingController extends AdminBaseController ...@@ -58,7 +58,9 @@ class SettingController extends AdminBaseController
$dbSettings = $this->setting->savedModuleSettings($currentModule->getLowerName()); $dbSettings = $this->setting->savedModuleSettings($currentModule->getLowerName());
return view('setting::admin.module-settings', return view(
compact('currentModule', 'translatableSettings', 'plainSettings', 'dbSettings', 'modulesWithSettings')); 'setting::admin.module-settings',
compact('currentModule', 'translatableSettings', 'plainSettings', 'dbSettings', 'modulesWithSettings')
);
} }
} }
...@@ -35,7 +35,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit ...@@ -35,7 +35,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByName.{$settingName}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findByName.{$settingName}",
$this->cacheTime,
function () use ($settingName) { function () use ($settingName) {
return $this->repository->findByName($settingName); return $this->repository->findByName($settingName);
} }
...@@ -54,7 +56,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit ...@@ -54,7 +56,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.moduleSettings.{$moduleList}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.moduleSettings.{$moduleList}",
$this->cacheTime,
function () use ($modules) { function () use ($modules) {
return $this->repository->moduleSettings($modules); return $this->repository->moduleSettings($modules);
} }
...@@ -70,7 +74,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit ...@@ -70,7 +74,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.savedModuleSettings.{$module}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.savedModuleSettings.{$module}",
$this->cacheTime,
function () use ($module) { function () use ($module) {
return $this->repository->savedModuleSettings($module); return $this->repository->savedModuleSettings($module);
} }
...@@ -86,7 +92,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit ...@@ -86,7 +92,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.findByModule.{$module}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.findByModule.{$module}",
$this->cacheTime,
function () use ($module) { function () use ($module) {
return $this->repository->findByModule($module); return $this->repository->findByModule($module);
} }
...@@ -102,7 +110,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit ...@@ -102,7 +110,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.get.{$settingName}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.get.{$settingName}",
$this->cacheTime,
function () use ($settingName) { function () use ($settingName) {
return $this->repository->get($settingName); return $this->repository->get($settingName);
} }
...@@ -118,7 +128,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit ...@@ -118,7 +128,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.translatableModuleSettings.{$module}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.translatableModuleSettings.{$module}",
$this->cacheTime,
function () use ($module) { function () use ($module) {
return $this->repository->translatableModuleSettings($module); return $this->repository->translatableModuleSettings($module);
} }
...@@ -134,7 +146,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit ...@@ -134,7 +146,9 @@ class CacheSettingDecorator extends BaseCacheDecorator implements SettingReposit
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.plainModuleSettings.{$module}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.plainModuleSettings.{$module}",
$this->cacheTime,
function () use ($module) { function () use ($module) {
return $this->repository->plainModuleSettings($module); return $this->repository->plainModuleSettings($module);
} }
......
...@@ -23,7 +23,9 @@ class CacheTagDecorator extends BaseCacheDecorator implements TagRepository ...@@ -23,7 +23,9 @@ class CacheTagDecorator extends BaseCacheDecorator implements TagRepository
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allForNamespace.{$namespace}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.allForNamespace.{$namespace}",
$this->cacheTime,
function () use ($namespace) { function () use ($namespace) {
return $this->repository->allForNamespace($namespace); return $this->repository->allForNamespace($namespace);
} }
......
...@@ -27,7 +27,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio ...@@ -27,7 +27,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio
$locale = $locale ?: app()->getLocale(); $locale = $locale ?: app()->getLocale();
return app('cache')->driver('translations') return app('cache')->driver('translations')
->rememberForever("{$this->entityName}.findByKeyAndLocale.{$cleanKey}.{$locale}", ->rememberForever(
"{$this->entityName}.findByKeyAndLocale.{$cleanKey}.{$locale}",
function () use ($key, $locale) { function () use ($key, $locale) {
return $this->repository->findByKeyAndLocale($key, $locale); return $this->repository->findByKeyAndLocale($key, $locale);
} }
...@@ -37,7 +38,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio ...@@ -37,7 +38,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio
public function allFormatted() public function allFormatted()
{ {
return app('cache')->driver('translations') return app('cache')->driver('translations')
->rememberForever("{$this->locale}.{$this->entityName}.allFormatted", ->rememberForever(
"{$this->locale}.{$this->entityName}.allFormatted",
function () { function () {
return $this->repository->allFormatted(); return $this->repository->allFormatted();
} }
...@@ -56,7 +58,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio ...@@ -56,7 +58,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio
$cleanKey = $this->cleanKey($key); $cleanKey = $this->cleanKey($key);
return app('cache')->driver('translations') return app('cache')->driver('translations')
->rememberForever("{$this->locale}.{$this->entityName}.findTranslationByKey.{$cleanKey}", ->rememberForever(
"{$this->locale}.{$this->entityName}.findTranslationByKey.{$cleanKey}",
function () use ($key) { function () use ($key) {
return $this->repository->findTranslationByKey($key); return $this->repository->findTranslationByKey($key);
} }
...@@ -102,7 +105,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio ...@@ -102,7 +105,8 @@ class CacheTranslationDecorator extends BaseCacheDecorator implements Translatio
public function getTranslationsForGroupAndNamespace($locale, $group, $namespace) public function getTranslationsForGroupAndNamespace($locale, $group, $namespace)
{ {
return app('cache')->driver('translations') return app('cache')->driver('translations')
->rememberForever("{$this->entityName}.findByKeyAndLocale.{$locale}.{$group}.[$namespace]", ->rememberForever(
"{$this->entityName}.findByKeyAndLocale.{$locale}.{$group}.[$namespace]",
function () use ($locale, $group, $namespace) { function () use ($locale, $group, $namespace) {
return $this->repository->getTranslationsForGroupAndNamespace($locale, $group, $namespace); return $this->repository->getTranslationsForGroupAndNamespace($locale, $group, $namespace);
} }
......
...@@ -28,7 +28,9 @@ class CacheUserTokenDecorator extends BaseCacheDecorator implements UserTokenRep ...@@ -28,7 +28,9 @@ class CacheUserTokenDecorator extends BaseCacheDecorator implements UserTokenRep
{ {
return $this->cache return $this->cache
->tags([$this->entityName, 'global']) ->tags([$this->entityName, 'global'])
->remember("{$this->locale}.{$this->entityName}.allForUser.{$userId}", $this->cacheTime, ->remember(
"{$this->locale}.{$this->entityName}.allForUser.{$userId}",
$this->cacheTime,
function () use ($userId) { function () use ($userId) {
return $this->repository->allForUser($userId); return $this->repository->allForUser($userId);
} }
......
...@@ -81,8 +81,10 @@ class ModulesController extends AdminBaseController ...@@ -81,8 +81,10 @@ class ModulesController extends AdminBaseController
{ {
$module->enable(); $module->enable();
return redirect()->route('admin.workshop.modules.show', [$module->getLowerName()])->with('success', return redirect()->route('admin.workshop.modules.show', [$module->getLowerName()])->with(
trans('workshop::modules.module enabled')); 'success',
trans('workshop::modules.module enabled')
);
} }
/** /**
......
...@@ -10,7 +10,8 @@ $router->bind('theme', function ($theme) { ...@@ -10,7 +10,8 @@ $router->bind('theme', function ($theme) {
return app(\Modules\Workshop\Manager\ThemeManager::class)->find($theme); return app(\Modules\Workshop\Manager\ThemeManager::class)->find($theme);
}); });
$router->group(['prefix' => '/workshop'], $router->group(
['prefix' => '/workshop'],
function (Router $router) { function (Router $router) {
$router->get('modules', [ $router->get('modules', [
'as' => 'admin.workshop.modules.index', 'as' => 'admin.workshop.modules.index',
......
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