Skip to content

Commit

Permalink
for 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
summerblue committed Sep 19, 2019
1 parent 78ef029 commit 7ccb614
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "summerblue/generator",
"description": "Extend Laravel 5.5's generators scaffold.",
"description": "Extend Laravel's generators scaffold.",
"keywords": [
"laravel",
"generators",
Expand All @@ -23,8 +23,8 @@
"php": ">=7.0.0"
},
"require-dev": {
"phpunit/phpunit": "~5.7",
"laravel/laravel": "5.5.*"
"phpunit/phpunit": "^8.0",
"laravel/laravel": "6.*"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 4 additions & 4 deletions src/Commands/ScaffoldMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ public function getObjName($config = 'Name')
$args_name = $this->argument('name');

// Name[0] = Tweet
$names['Name'] = str_singular(ucfirst($args_name));
$names['Name'] = \Str::singular(ucfirst($args_name));
// Name[1] = Tweets
$names['Names'] = str_plural(ucfirst($args_name));
$names['Names'] = \Str::plural(ucfirst($args_name));
// Name[2] = tweets
$names['names'] = str_plural(strtolower(preg_replace('/(?<!^)([A-Z])/', '_$1', $args_name)));
$names['names'] = \Str::plural(strtolower(preg_replace('/(?<!^)([A-Z])/', '_$1', $args_name)));
// Name[3] = tweet
$names['name'] = str_singular(strtolower(preg_replace('/(?<!^)([A-Z])/', '_$1', $args_name)));
$names['name'] = \Str::singular(strtolower(preg_replace('/(?<!^)([A-Z])/', '_$1', $args_name)));


if (!isset($names[$config])) {
Expand Down
6 changes: 3 additions & 3 deletions src/Makes/MakeMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(ScaffoldMakeCommand $scaffoldCommand, Filesystem $fi
* @return void
*/
protected function start(){
$name = 'create_'.str_plural(strtolower( $this->scaffoldCommandObj->argument('name') )).'_table';
$name = 'create_'.\Str::plural(strtolower( $this->scaffoldCommandObj->argument('name') )).'_table';
$path = $this->getPath($name);

if ( ! $this->classExists($name))
Expand Down Expand Up @@ -99,7 +99,7 @@ protected function replaceSchema(&$stub)

$schema = (new SyntaxBuilder)->create($schema, $this->scaffoldCommandObj->getMeta());
$stub = str_replace(['{{schema_up}}', '{{schema_down}}'], $schema, $stub);

return $this;
}

Expand All @@ -114,4 +114,4 @@ public function classExists($name)

return false;
}
}
}
4 changes: 2 additions & 2 deletions src/Migrations/SchemaParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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 Expand Up @@ -147,7 +147,7 @@ private function addForeignConstraint($segments)
*/
private function getTableNameFromForeignKey($key)
{
return str_plural(str_replace('_id', '', $key));
return \Str::plural(str_replace('_id', '', $key));
}

/**
Expand Down

0 comments on commit 7ccb614

Please sign in to comment.