diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/.DS_Store differ diff --git a/build-test-project.sh b/build-test-project.sh index de2a650..cc35ead 100644 --- a/build-test-project.sh +++ b/build-test-project.sh @@ -22,9 +22,17 @@ sed -i '' "s/DB_DATABASE=homestead/DB_DATABASE=$db_database/g" .env sed -i '' "s/DB_USERNAME=homestead/DB_USERNAME=$db_username/g" .env sed -i '' "s/DB_PASSWORD=secret/DB_PASSWORD=$db_password/g" .env sed -i '' "s|// \$this->call(UsersTableSeeder::class);|\$this->call(UsersTableSeeder::class);|" ./database/seeds/DatabaseSeeder.php + +sed -i '' 's/Laravel\\Tinker\\TinkerServiceProvider::class,/Laravel\\Tinker\\TinkerServiceProvider::class,\ + Showcase\\App\\Providers\\ShowcaseProvider::class,\ + Laracasts\\Flash\\FlashServiceProvider::class,/' ./config/app.php + cp ../UsersTableSeeder.php ./database/seeds/ -php artisan make:auth composer require brokerexchange/showcase=dev-feature/1.0 +composer dump-autoload +echo "Pre auth" +php artisan make:auth +echo "Post auth" npm install cd .. bash update-test-project.sh --migrations --rundev diff --git a/composer.json b/composer.json index 09623c5..0ac919e 100644 --- a/composer.json +++ b/composer.json @@ -13,8 +13,7 @@ "fzaninotto/faker": "^1.4", "illuminate/filesystem": "^5.4", "illuminate/pagination": "^5.4", - "nesbot/carbon": "^1.27", - "doctrine/inflector": "1.1" + "nesbot/carbon": "^1.27" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock deleted file mode 100644 index fff05ff..0000000 --- a/composer.lock +++ /dev/null @@ -1,862 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "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": "96dd6f5669b143afca2e57c563a16624", - "packages": [ - { - "name": "doctrine/inflector", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae", - "reference": "90b2128806bfde671b6952ab8bea493942c1fdae", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Inflector\\": "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" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "inflection", - "pluralize", - "singularize", - "string" - ], - "time": "2015-11-06T14:35:42+00:00" - }, - { - "name": "fzaninotto/faker", - "version": "v1.7.1", - "source": { - "type": "git", - "url": "https://github.com/fzaninotto/Faker.git", - "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", - "reference": "d3ed4cc37051c1ca52d22d76b437d14809fc7e0d", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "ext-intl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", - "squizlabs/php_codesniffer": "^1.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "François Zaninotto" - } - ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "time": "2017-08-15T16:48:10+00:00" - }, - { - "name": "illuminate/container", - "version": "v5.6.21", - "source": { - "type": "git", - "url": "https://github.com/illuminate/container.git", - "reference": "4a42d667a05ec6d31f05b532cdac7e8e68e5ea2a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/4a42d667a05ec6d31f05b532cdac7e8e68e5ea2a", - "reference": "4a42d667a05ec6d31f05b532cdac7e8e68e5ea2a", - "shasum": "" - }, - "require": { - "illuminate/contracts": "5.6.*", - "php": "^7.1.3", - "psr/container": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Container\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Container package.", - "homepage": "https://laravel.com", - "time": "2018-01-21T02:13:38+00:00" - }, - { - "name": "illuminate/contracts", - "version": "v5.6.21", - "source": { - "type": "git", - "url": "https://github.com/illuminate/contracts.git", - "reference": "6a11fbccbc7da16a85fcd1d4b08e51b5658de0d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/6a11fbccbc7da16a85fcd1d4b08e51b5658de0d4", - "reference": "6a11fbccbc7da16a85fcd1d4b08e51b5658de0d4", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "psr/container": "~1.0", - "psr/simple-cache": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Contracts\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Contracts package.", - "homepage": "https://laravel.com", - "time": "2018-05-08T13:22:33+00:00" - }, - { - "name": "illuminate/database", - "version": "v5.6.21", - "source": { - "type": "git", - "url": "https://github.com/illuminate/database.git", - "reference": "7ab07d133ece8098b6f5f872ec95d080087236c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/database/zipball/7ab07d133ece8098b6f5f872ec95d080087236c0", - "reference": "7ab07d133ece8098b6f5f872ec95d080087236c0", - "shasum": "" - }, - "require": { - "illuminate/container": "5.6.*", - "illuminate/contracts": "5.6.*", - "illuminate/support": "5.6.*", - "php": "^7.1.3" - }, - "suggest": { - "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.6).", - "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", - "illuminate/console": "Required to use the database commands (5.6.*).", - "illuminate/events": "Required to use the observers with Eloquent (5.6.*).", - "illuminate/filesystem": "Required to use the migrations (5.6.*).", - "illuminate/pagination": "Required to paginate the result set (5.6.*)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Database\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Database package.", - "homepage": "https://laravel.com", - "keywords": [ - "database", - "laravel", - "orm", - "sql" - ], - "time": "2018-05-07T14:20:13+00:00" - }, - { - "name": "illuminate/filesystem", - "version": "v5.6.21", - "source": { - "type": "git", - "url": "https://github.com/illuminate/filesystem.git", - "reference": "a4ca4a9c2f969ec227748ab334693144995ba0ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/filesystem/zipball/a4ca4a9c2f969ec227748ab334693144995ba0ce", - "reference": "a4ca4a9c2f969ec227748ab334693144995ba0ce", - "shasum": "" - }, - "require": { - "illuminate/contracts": "5.6.*", - "illuminate/support": "5.6.*", - "php": "^7.1.3", - "symfony/finder": "~4.0" - }, - "suggest": { - "league/flysystem": "Required to use the Flysystem local and FTP drivers (~1.0).", - "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", - "league/flysystem-cached-adapter": "Required to use the Flysystem cache (~1.0).", - "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", - "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (~1.0)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Filesystem\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Filesystem package.", - "homepage": "https://laravel.com", - "time": "2018-05-02T16:10:37+00:00" - }, - { - "name": "illuminate/pagination", - "version": "v5.6.21", - "source": { - "type": "git", - "url": "https://github.com/illuminate/pagination.git", - "reference": "ee3177bd380ea2be7c0330d8ef8b0ab858be8947" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/pagination/zipball/ee3177bd380ea2be7c0330d8ef8b0ab858be8947", - "reference": "ee3177bd380ea2be7c0330d8ef8b0ab858be8947", - "shasum": "" - }, - "require": { - "illuminate/contracts": "5.6.*", - "illuminate/support": "5.6.*", - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Pagination\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Pagination package.", - "homepage": "https://laravel.com", - "time": "2018-05-06T14:22:45+00:00" - }, - { - "name": "illuminate/support", - "version": "v5.6.21", - "source": { - "type": "git", - "url": "https://github.com/illuminate/support.git", - "reference": "6e84d4140310246ace38fdb0909da5b2fb22eadf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/6e84d4140310246ace38fdb0909da5b2fb22eadf", - "reference": "6e84d4140310246ace38fdb0909da5b2fb22eadf", - "shasum": "" - }, - "require": { - "doctrine/inflector": "~1.1", - "ext-mbstring": "*", - "illuminate/contracts": "5.6.*", - "nesbot/carbon": "^1.24.1", - "php": "^7.1.3" - }, - "conflict": { - "tightenco/collect": "<5.5.33" - }, - "suggest": { - "illuminate/filesystem": "Required to use the composer class (5.6.*).", - "symfony/process": "Required to use the composer class (~4.0).", - "symfony/var-dumper": "Required to use the dd function (~4.0)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.6-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Support\\": "" - }, - "files": [ - "helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Support package.", - "homepage": "https://laravel.com", - "time": "2018-05-07T14:12:37+00:00" - }, - { - "name": "laracasts/flash", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/laracasts/flash.git", - "reference": "10cd420ab63fd0796bf5e1e5b99f87636d2f4333" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laracasts/flash/zipball/10cd420ab63fd0796bf5e1e5b99f87636d2f4333", - "reference": "10cd420ab63fd0796bf5e1e5b99f87636d2f4333", - "shasum": "" - }, - "require": { - "illuminate/support": "~5.0", - "php": ">=5.4.0" - }, - "require-dev": { - "mockery/mockery": "dev-master", - "phpunit/phpunit": "^6.1" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Laracasts\\Flash\\FlashServiceProvider" - ], - "aliases": { - "Flash": "Laracasts\\Flash\\Flash" - } - } - }, - "autoload": { - "psr-0": { - "Laracasts\\Flash": "src/" - }, - "files": [ - "src/Laracasts/Flash/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeffrey Way", - "email": "jeffrey@laracasts.com" - } - ], - "description": "Easy flash notifications", - "time": "2017-06-22T19:01:19+00:00" - }, - { - "name": "nesbot/carbon", - "version": "1.27.0", - "source": { - "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "ef81c39b67200dcd7401c24363dcac05ac3a4fe9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ef81c39b67200dcd7401c24363dcac05ac3a4fe9", - "reference": "ef81c39b67200dcd7401c24363dcac05ac3a4fe9", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/translation": "~2.6 || ~3.0 || ~4.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2", - "phpunit/phpunit": "^4.8.35 || ^5.7" - }, - "type": "library", - "autoload": { - "psr-4": { - "": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "http://nesbot.com" - } - ], - "description": "A simple API extension for DateTime.", - "homepage": "http://carbon.nesbot.com", - "keywords": [ - "date", - "datetime", - "time" - ], - "time": "2018-04-23T09:02:57+00:00" - }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "time": "2017-10-23T01:57:42+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.0.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ca27c02b7a3fef4828c998c2ff9ba7aae1641c49", - "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2018-04-04T05:10:37+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2018-04-26T10:06:28+00:00" - }, - { - "name": "symfony/translation", - "version": "v4.0.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "ad3abf08eb3450491d8d76513100ef58194cd13e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/ad3abf08eb3450491d8d76513100ef58194cd13e", - "reference": "ad3abf08eb3450491d8d76513100ef58194cd13e", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/intl": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2018-04-30T01:23:47+00:00" - } - ], - "packages-dev": [ - { - "name": "squizlabs/php_codesniffer", - "version": "3.2.3", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "4842476c434e375f9d3182ff7b89059583aa8b27" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4842476c434e375f9d3182ff7b89059583aa8b27", - "reference": "4842476c434e375f9d3182ff7b89059583aa8b27", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2018-02-20T21:35:23+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/src/Showcase.php b/src/Showcase.php index 284bb7a..20ea3b6 100644 --- a/src/Showcase.php +++ b/src/Showcase.php @@ -26,4 +26,23 @@ public static function display($display) return $display; } + + /** + * Check to see if a template file exists. + * + * Check to see if a template file exists, either in the vendor path or the + * published user path. + * + * @param string $file + * @param string $type + * @return boolean + */ + public static function templateFileExists($file, $type) + { + if ($type !== 'display' && $type !== 'trophy') { + throw new \Exception("Invalid type ($type)."); + } + return file_exists(base_path() . "/resources/views/vendor/showcase/public/components/$type/$file.blade.php") + ?: file_exists(__DIR__."/resources/views/public/components/$type/$file.blade.php"); + } } \ No newline at end of file diff --git a/src/app/Http/Controllers/DisplayController.php b/src/app/Http/Controllers/DisplayController.php index b4853fa..774388f 100644 --- a/src/app/Http/Controllers/DisplayController.php +++ b/src/app/Http/Controllers/DisplayController.php @@ -3,6 +3,7 @@ namespace Showcase\App\Http\Controllers; use Showcase\App\Display; +use Showcase\App\Trophy; use Illuminate\Http\Request; use Showcase\App\Http\Requests\DisplayRequest; @@ -25,7 +26,7 @@ public function index() */ public function create() { - return view('showcase::app.display.create'); + return view('showcase::app.display.create', compact('trophies')); } /** @@ -38,9 +39,12 @@ public function store(DisplayRequest $request) { $request->merge(['force_trophy_default' => isset($request->force_trophy_default) ? true : false]); - Display::create($request->all()); + $display = Display::create($request->except('trophies')); - return redirect()->route('displays.index'); + $display->trophies()->detach(); + $display->trophies()->attach($request->trophies); + + return redirect()->route('displays.show', compact('display')); } /** @@ -62,7 +66,7 @@ public function show(Display $display) */ public function edit(Display $display) { - return view('showcase::app.display.edit', compact('display')); + return view('showcase::app.display.edit', compact('display', 'trophies')); } /** @@ -76,7 +80,10 @@ public function update(DisplayRequest $request, Display $display) { $request->merge(['force_trophy_default' => isset($request->force_trophy_default) ? true : false]); - $display->update($request->all()); + $display->update($request->except('trophies')); + + $display->trophies()->detach(); + $display->trophies()->attach($request->trophies); return redirect()->route('displays.show', compact('display')); } diff --git a/src/app/Http/Requests/DisplayRequest.php b/src/app/Http/Requests/DisplayRequest.php index 39d0b2a..b7fa17d 100644 --- a/src/app/Http/Requests/DisplayRequest.php +++ b/src/app/Http/Requests/DisplayRequest.php @@ -29,8 +29,8 @@ public function rules() return [ 'name' => $name, - 'component_view' => 'required|string', - 'default_trophy_component_view' => 'required|string', + 'component_view' => 'required|string|display_exists', + 'default_trophy_component_view' => 'required|string|trophy_exists', 'force_trophy_default' => 'nullable|boolean' ]; } @@ -49,4 +49,15 @@ public function withValidator($validator) }); }); } + + /** + * Add custom error messages. + */ + public function messages() + { + return [ + 'display_exists' => __('showcase::validation.display_exists'), + 'trophy_exists' => __('showcase::validation.trophy_exists') + ]; + } } diff --git a/src/app/Http/Requests/TrophyRequest.php b/src/app/Http/Requests/TrophyRequest.php index 126fc22..4d6c13e 100644 --- a/src/app/Http/Requests/TrophyRequest.php +++ b/src/app/Http/Requests/TrophyRequest.php @@ -29,7 +29,7 @@ public function rules() return [ 'name' => $name, - 'component_view' => 'string', + 'component_view' => 'string|trophy_exists', 'link' => 'nullable|url', 'image_url' => 'nullable|url', 'description' => 'nullable|string|max:'.config('showcase.description_length', 55) @@ -50,4 +50,14 @@ public function withValidator($validator) }); }); } + + /** + * Add custom error messages. + */ + public function messages() + { + return [ + 'trophy_exists' => __('showcase::validation.trophy_exists') + ]; + } } diff --git a/src/app/Providers/ShowcaseProvider.php b/src/app/Providers/ShowcaseProvider.php index 930d52c..a2eb99a 100644 --- a/src/app/Providers/ShowcaseProvider.php +++ b/src/app/Providers/ShowcaseProvider.php @@ -3,6 +3,7 @@ namespace Showcase\App\Providers; use Illuminate\Support\Facades\Blade; +use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; @@ -17,6 +18,7 @@ public function boot() { $this->loadMigrationsFrom(__DIR__.'/../../database/migrations'); $this->loadRoutesFrom(__DIR__.'/../../routes.php'); + $this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'showcase'); $this->loadViewsFrom(__DIR__.'/../../resources/views', 'showcase'); $this->publishes([ @@ -47,9 +49,29 @@ public function boot() return "startComponent(\"showcase::public.components.trophy.\".($showcaseStr), ['trophy' => {$trophy}, 'display' => $displayStr]); ?>renderComponent(); ?>"; }); + Validator::extend('display_exists', function ($attribute, $value, $parameters, $validator) { + return \Showcase\Showcase::templateFileExists($value, 'display'); + }); + + Validator::extend('trophy_exists', function ($attribute, $value, $parameters, $validator) { + return \Showcase\Showcase::templatefileExists($value, 'trophy'); + }); + + Validator::replacer('display_exists', function ($message, $attribute, $rule, $parameters, $validator) { + return str_replace([':value'], [$validator->getData()[$attribute]], $message); + }); + + Validator::replacer('trophy_exists', function ($message, $attribute, $rule, $parameters, $validator) { + return str_replace([':value'], [$validator->getData()[$attribute]], $message); + }); + if (count(\DB::select(\DB::raw('SHOW TABLES LIKE "' . config('showcase.table_prefix', 'showcase_').'displays"'))) > 0) { - $displays = \Showcase\App\Display::with('trophies')->get(); - $trophies = \Showcase\App\Trophy::all(); + $displays = \Showcase\App\Display::with('trophies')->get()->filter(function ($display) { + return \Showcase\Showcase::templateFileExists($display->component_view, 'display'); + }); + $trophies = \Showcase\App\Trophy::all()->filter(function ($trophy) { + return \Showcase\Showcase::templateFileExists($trophy->component_view, 'trophy'); + }); View::share('displays', $displays); View::share('trophies', $trophies); } diff --git a/src/resources/lang/en/validation.php b/src/resources/lang/en/validation.php new file mode 100644 index 0000000..6270b5e --- /dev/null +++ b/src/resources/lang/en/validation.php @@ -0,0 +1,6 @@ + 'The display component file ":value.blade.php" does not exist.', + 'trophy_exists' => 'The trophy component file ":value.blade.php" does not exist.', +]; diff --git a/src/resources/views/app/display/create.blade.php b/src/resources/views/app/display/create.blade.php index bcc1296..42484a4 100644 --- a/src/resources/views/app/display/create.blade.php +++ b/src/resources/views/app/display/create.blade.php @@ -21,6 +21,14 @@ +