diff --git a/app/CMS/ModuleManager/Providers/ModuleManager.php b/app/CMS/ModuleManager/Providers/ModuleManager.php index ee74629d..3c108207 100644 --- a/app/CMS/ModuleManager/Providers/ModuleManager.php +++ b/app/CMS/ModuleManager/Providers/ModuleManager.php @@ -16,7 +16,6 @@ class ModuleManager extends ServiceProvider // this service provider needs published config - config is merged right after this service provider $modules = app(ModuleRepository::class)->getOnlyModules(); - // iterate over all modules and enable or disable them foreach ($modules as $module) { if (isset($module->module_settings['providers']) && !empty($module->module_settings['providers'])) { diff --git a/app/Console/Commands/ChangePassword.php b/app/Console/Commands/ChangePassword.php index d8ab70a9..bb0789a8 100644 --- a/app/Console/Commands/ChangePassword.php +++ b/app/Console/Commands/ChangePassword.php @@ -30,7 +30,7 @@ class ChangePassword extends Command $email = $this->argument('email'); try { $user = User::where(['email' => $email]) - ->first(); + ->firstOrFail(); } catch (ModelNotFoundException $e) { $this->error('Invalid user ' . $email . '.'); return; diff --git a/app/Console/Commands/NewUser.php b/app/Console/Commands/NewUser.php index f700d9fe..725b67dc 100644 --- a/app/Console/Commands/NewUser.php +++ b/app/Console/Commands/NewUser.php @@ -3,6 +3,7 @@ namespace App\Console\Commands; use App\CMS\Enumerations\UserRoles; +use App\Events\CreateNewUser; use App\Models\User; use Illuminate\Console\Command; use Illuminate\Support\Facades\Hash; @@ -63,6 +64,8 @@ class NewUser extends Command $user->role = $role; $user->save(); + event(new CreateNewUser($user)); + $this->info('User ' . $email . ' successfully created.'); } } diff --git a/app/Policies/BasicPolicy.php b/app/Policies/BasicPolicy.php index eb18ce69..b8e0d647 100644 --- a/app/Policies/BasicPolicy.php +++ b/app/Policies/BasicPolicy.php @@ -5,6 +5,7 @@ namespace App\Policies; use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\Auth; abstract class BasicPolicy { @@ -20,7 +21,6 @@ abstract class BasicPolicy */ public function before(User $user, $ability) { - // check if user can operate on given entity if (!$this->manage($user)) { return false; diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index fdf18d8e..8274cab6 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -62,7 +62,6 @@ class AppServiceProvider extends ServiceProvider $this->app->register(DebugBarServiceProvider::class); } - // register PingPong module extension $this->app->register(LaravelLocalizationServiceProvider::class); // create singletons for registering widgets diff --git a/composer.json b/composer.json index 592e97c3..e289cf05 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,8 @@ "phpunit/phpunit": "~4.0", "symfony/css-selector": "2.8.*|3.0.*", "symfony/dom-crawler": "2.8.*|3.0.*", - "barryvdh/laravel-debugbar": "^2.1" + "barryvdh/laravel-debugbar": "^2.1", + "doctrine/dbal": "^2.7@dev" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index 800699ac..aa1f486c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,367 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "c1d95b3a28c04323c45a7fab876aadb7", + "content-hash": "fa573169a51e5b333f6189601f32141d", "packages": [ + { + "name": "doctrine/annotations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "2497b1f9db56278d3ad2248f9e4bdbbbaa271c3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/2497b1f9db56278d3ad2248f9e4bdbbbaa271c3e", + "reference": "2497b1f9db56278d3ad2248f9e4bdbbbaa271c3e", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-07-22T11:08:38+00:00" + }, + { + "name": "doctrine/cache", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "6ae1365e2b16aceb3394e4308f1a1b594dd57f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/6ae1365e2b16aceb3394e4308f1a1b594dd57f11", + "reference": "6ae1365e2b16aceb3394e4308f1a1b594dd57f11", + "shasum": "" + }, + "require": { + "php": "~7.1" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "alcaeus/mongo-php-adapter": "^1.1", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2017-07-22T13:34:02+00:00" + }, + { + "name": "doctrine/collections", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "d702afb7da35ed1110ad760013ec6f354d374feb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/d702afb7da35ed1110ad760013ec6f354d374feb", + "reference": "d702afb7da35ed1110ad760013ec6f354d374feb", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Collections\\": "lib/Doctrine/Common/Collections" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2017-07-24T08:02:48+00:00" + }, + { + "name": "doctrine/common", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "9387d3066ec15e2a0329bb9e2598aed4eff104f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/9387d3066ec15e2a0329bb9e2598aed4eff104f7", + "reference": "9387d3066ec15e2a0329bb9e2598aed4eff104f7", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~7.1" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.9.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2017-07-22T09:50:40+00:00" + }, + { + "name": "doctrine/dbal", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "6fdfcab2a0ca2063a4fd1b0ba7fa0988c14ef957" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/6fdfcab2a0ca2063a4fd1b0ba7fa0988c14ef957", + "reference": "6fdfcab2a0ca2063a4fd1b0ba7fa0988c14ef957", + "shasum": "" + }, + "require": { + "doctrine/common": "^2.7.1", + "ext-pdo": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^5.4.6", + "phpunit/phpunit-mock-objects": "!=3.2.4,!=3.2.5", + "symfony/console": "2.*||^3.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2017-08-18T15:53:06+00:00" + }, { "name": "doctrine/inflector", "version": "1.1.x-dev", @@ -73,6 +432,60 @@ ], "time": "2015-11-06T14:35:42+00:00" }, + { + "name": "doctrine/lexer", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "cc709ba91eee09540091ad5a5f2616727662e41b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/cc709ba91eee09540091ad5a5f2616727662e41b", + "reference": "cc709ba91eee09540091ad5a5f2616727662e41b", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2017-07-24T09:37:08+00:00" + }, { "name": "erusev/parsedown", "version": "1.6.3", @@ -3629,7 +4042,8 @@ "minimum-stability": "dev", "stability-flags": { "greggilbert/recaptcha": 20, - "nwidart/laravel-menus": 20 + "nwidart/laravel-menus": 20, + "doctrine/dbal": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/database/migrations/2016_10_11_135756_AddUniqueCodeToWidgets.php b/database/migrations/2016_10_11_135756_AddUniqueCodeToWidgets.php index c8456ba9..2c24874d 100644 --- a/database/migrations/2016_10_11_135756_AddUniqueCodeToWidgets.php +++ b/database/migrations/2016_10_11_135756_AddUniqueCodeToWidgets.php @@ -1,5 +1,6 @@ dropUnique('widgets_language_container_id_unique'); - }); + try { + Schema::table('widgets', function (Blueprint $table) { + $table->dropUnique('widgets_language_container_id_unique'); + }); + } catch (\Exception $e) { + + } // migrate data - $widgets = \App\Models\Widget::all(); + $widgets = Widget::all(); foreach ($widgets as $widget) { $widget->settings = (object)json_decode($widget->settings); $widget->settings->containerClass = $widget->container_class; diff --git a/database/migrations/2016_10_25_071455_rename_column_in_contents.php b/database/migrations/2016_10_25_071455_rename_column_in_contents.php index 45b03e33..1ffcfd51 100644 --- a/database/migrations/2016_10_25_071455_rename_column_in_contents.php +++ b/database/migrations/2016_10_25_071455_rename_column_in_contents.php @@ -27,7 +27,6 @@ class RenameColumnInContents extends Migration 'url', 'meta_keywords', 'meta_description', - 'content', 'module_settings', 'status' ]; diff --git a/database/migrations/2017_08_24_011314_drop_custom_fields_tables.php b/database/migrations/2017_08_24_011314_drop_custom_fields_tables.php index 149e19fb..57a1c773 100644 --- a/database/migrations/2017_08_24_011314_drop_custom_fields_tables.php +++ b/database/migrations/2017_08_24_011314_drop_custom_fields_tables.php @@ -13,10 +13,10 @@ class DropCustomFieldsTables extends Migration { Schema::dropIfExists('content_has_custom_fields'); Schema::dropIfExists('user_has_custom_field'); - Schema::dropIfExists('custom_field_types'); - Schema::dropIfExists('custom_fields'); Schema::dropIfExists('custom_field_resource'); + Schema::dropIfExists('custom_fields'); Schema::dropIfExists('custom_field_resources'); + Schema::dropIfExists('custom_field_types'); } /**