From 395267831991a0a692ac259d303224355d14b43c Mon Sep 17 00:00:00 2001 From: Cristian Tabacitu Date: Tue, 3 Mar 2020 08:55:32 +0200 Subject: [PATCH 1/2] add support for Laravel 7 --- .travis.yml | 4 ++++ composer.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 35c5d69..3136004 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,15 @@ php: - 7.0 - 7.1 - 7.2 + - 7.3 + - 7.4 + - 8.0 - nightly matrix: allow_failures: - php: nightly + - php: 8.0 before_script: - composer self-update diff --git a/composer.json b/composer.json index 7d15cc6..4c45bd1 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": ">=5.4.0", - "illuminate/support": "~5.0|~6.0", + "illuminate/support": "~5.0|~6.0|~7.0", "laravel/helpers": "^1.1" }, "require-dev": { From ca9c69375f64923550907432b1056f54b4f3e9e7 Mon Sep 17 00:00:00 2001 From: Cristian Tabacitu Date: Tue, 3 Mar 2020 09:14:32 +0200 Subject: [PATCH 2/2] removed laravel/helpers dependency --- composer.json | 3 +-- src/Commands/MigrationMakeCommand.php | 5 +++-- src/Migrations/SchemaParser.php | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 4c45bd1..943605e 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,7 @@ ], "require": { "php": ">=5.4.0", - "illuminate/support": "~5.0|~6.0|~7.0", - "laravel/helpers": "^1.1" + "illuminate/support": "~5.0|~6.0|~7.0" }, "require-dev": { "phpspec/phpspec": "~2.1" diff --git a/src/Commands/MigrationMakeCommand.php b/src/Commands/MigrationMakeCommand.php index 800d1e5..195837b 100644 --- a/src/Commands/MigrationMakeCommand.php +++ b/src/Commands/MigrationMakeCommand.php @@ -5,6 +5,7 @@ use Illuminate\Console\Command; use Illuminate\Container\Container; use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Str; use Laracasts\Generators\Migrations\NameParser; use Laracasts\Generators\Migrations\SchemaParser; use Laracasts\Generators\Migrations\SyntaxBuilder; @@ -189,7 +190,7 @@ protected function compileMigrationStub() */ protected function replaceClassName(&$stub) { - $className = ucwords(camel_case($this->argument('name'))); + $className = ucwords(Str::camel($this->argument('name'))); $stub = str_replace('{{class}}', $className, $stub); @@ -237,7 +238,7 @@ protected function replaceSchema(&$stub) */ protected function getModelName() { - return ucwords(str_singular(camel_case($this->meta['table']))); + return ucwords(Str::singular(Str::camel($this->meta['table']))); } /** diff --git a/src/Migrations/SchemaParser.php b/src/Migrations/SchemaParser.php index aa8a600..a3edd1f 100644 --- a/src/Migrations/SchemaParser.php +++ b/src/Migrations/SchemaParser.php @@ -2,6 +2,8 @@ namespace Laracasts\Generators\Migrations; +use Illuminate\Support\Str; + class SchemaParser { /** @@ -104,7 +106,7 @@ private function parseOptions($options) if (empty($options)) return []; foreach ($options as $option) { - if (str_contains($option, '(')) { + if (Str::contains($option, '(')) { preg_match('/([a-z]+)\(([^\)]+)\)/i', $option, $matches); $results[$matches[1]] = $matches[2];