Skip to content

Commit

Permalink
Merge pull request #169 from laracasts/add-support-for-laravel-7
Browse files Browse the repository at this point in the history
[WIP] Add support for Laravel 7
  • Loading branch information
tabacitu authored Mar 3, 2020
2 parents e18d988 + ca9c693 commit 134fd33
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "~5.0|~6.0",
"laravel/helpers": "^1.1"
"illuminate/support": "~5.0|~6.0|~7.0"
},
"require-dev": {
"phpspec/phpspec": "~2.1"
Expand Down
5 changes: 3 additions & 2 deletions src/Commands/MigrationMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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'])));
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Migrations/SchemaParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Laracasts\Generators\Migrations;

use Illuminate\Support\Str;

class SchemaParser
{
/**
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 134fd33

Please sign in to comment.