From d267729898c526259dce689bd648e19cc2465aa2 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 3 Jun 2019 22:46:05 +1000 Subject: [PATCH] Ucfirst the api-reousrce to be created for convenience - in case the user forgot Also update old str functions with new --- src/Console/Commands/MakeApiResource.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Console/Commands/MakeApiResource.php b/src/Console/Commands/MakeApiResource.php index 135b48a..2c5bdbd 100644 --- a/src/Console/Commands/MakeApiResource.php +++ b/src/Console/Commands/MakeApiResource.php @@ -3,6 +3,7 @@ namespace Specialtactics\L5Api\Console\Commands; use Illuminate\Console\Command; +use Illuminate\Support\Str; class MakeApiResource extends Command { @@ -37,7 +38,7 @@ public function __construct() */ public function handle() { - $name = $this->argument('name'); + $name = ucfirst($this->argument('name')); // // Model - Controller - (Policy) @@ -56,12 +57,12 @@ public function handle() // Migration - (Seed) // - $migrationName = 'create_' . str_plural(snake_case($name)) . '_table'; + $migrationName = 'create_' . Str::plural(Str::snake($name)) . '_table'; $this->call('make:migration', ['name' => $migrationName]); // Conditionally create seeder if ($this->anticipate('Would you like to create a Seeder for this resource?', ['yes', 'no']) == 'yes') { - $this->call('make:seeder', ['name' => str_plural($name) . 'Seeder']); + $this->call('make:seeder', ['name' => Str::plural($name) . 'Seeder']); } // @todo: Add seeder class to DatabaseSeeder.php