Skip to content

Commit

Permalink
Ucfirst the api-reousrce to be created for convenience - in case the …
Browse files Browse the repository at this point in the history
…user forgot

Also update old str functions with new
  • Loading branch information
specialtactics committed Jun 3, 2019
1 parent a1093d8 commit d267729
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Console/Commands/MakeApiResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Specialtactics\L5Api\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Str;

class MakeApiResource extends Command
{
Expand Down Expand Up @@ -37,7 +38,7 @@ public function __construct()
*/
public function handle()
{
$name = $this->argument('name');
$name = ucfirst($this->argument('name'));

//
// Model - Controller - (Policy)
Expand All @@ -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
Expand Down

0 comments on commit d267729

Please sign in to comment.