2015-01-09 83 views
0

願與你檢查什麼問題,當我嘗試用崇高的文本3 Laravel工匠4生成的資源,並與這些錯誤返回我,當有人問我,如果我想創建模型?Laravel資源生成與崇高的文本3 RuntimeException的中止

你要我創建一個狗模型? [是|否]

[RuntimeException的]中止

產生:資源[--fields [= 「...」]]資源

[完成了0.4秒,退出碼1] [CMD :PHP C:\用戶\肯尼\收存箱\項目\測試\人員產生:資源狗 --fields =名:字符串,年齡:整數] [DIR:C:\用戶\肯尼\收存箱\項目\測試]文件(x86)\ Intel \ iCLS Client \; C:\ Program Files \ Oracle \ Java \ javapath; C:\ Program Files (x86)\ NVIDIA Corporation \ PhysX \ Common; \ Program Files \ Intel \ iCLS Client \; C:\ Windows \ system32; C:\ Windows; C:\ Windows \ System32 \ Wbem; C:\ Windows \ System32 \ WindowsPowerShell \ v1.0 \; C:\ Program Files \ Intel \ Intel R)管理引擎組件\ DAL; C:\ Program Files \ Intel \ Intel(R)管理引擎組件\ IPT; C:\ Program Files (x86)\ Intel \ Intel(R)Management Engine Components \ DAL; C :\ Program Files文件 (86)\英特爾\英特爾(R)管理引擎組件\ IPT; C:\ Program Files文件 (86)\英特爾\ OpenCL的SDK \ 2.0 \ BIN \ 86; C:\程序文件(x86) \英特爾\ OpenCL的 SDK \ 2.0 \ BIN \ 64; C:\ Program Files文件(x86)的\的Windows 直播\共享; C:\ HashiCorp \流浪\ BIN; C:\ PHP; C:\ ProgramData \ ComposerSetup \ BIN ; C:\ PROGRAM 文件(x86)\ Git的\ CMD; C:\ Program Files文件(x86)的\的Git \ BIN; C:\ PROGRAM 文件\的NodeJS \; C:\用戶\肯尼\應用程序數據\ Roamin g^\ NPM]

下面是我的崇高安裝的軟件包

{ 
    "in_process_packages": 
    [ 
    ], 
    "installed_dependencies": 
    [ 
     "0_package_control_loader", 
     "bz2" 
    ], 
    "installed_packages": 
    [ 
     "AngularJS", 
     "CSS3", 
     "HTML-CSS-JS Prettify", 
     "Laravel 4 Artisan", 
     "Package Control", 
     "PhpDoc" 
    ] 
} 

感謝您提前幫助。

+0

你有沒有嘗試與空間inbetween字段像'名稱:字符串,年齡:整數' –

+0

@JenoKarthic是隊友...我已經嘗試過任何可能的組合與語法...即使我只用1屬性名稱嘗試:字符串 –

回答

1

你可以在當地找到名稱ResourceGeneratorCommand.php文件:vendor\way\generators\src\Way\Generators\Commands

和評論的所有代碼if($this->confirm....)

,或者你可以複製所有代碼代碼全部回覆:

<?php 
namespace Way\Generators\Commands; 

use Illuminate\Console\Command; 
use Symfony\Component\Console\Input\InputOption; 
use Symfony\Component\Console\Input\InputArgument; 

class ResourceGeneratorCommand extends Command { 

    /** 
    * The console command name. 
    * 
    * @var string 
    */ 
    protected $name = 'generate:resource'; 

    /** 
    * The console command description. 
    * 
    * @var string 
    */ 
    protected $description = 'Generate a new resource'; 

    /** 
    * Generate a resource 
    * 
    * @return mixed 
    */ 
    public function fire() 
    { 
     $resource = $this->argument('resource'); 

     $this->callModel($resource); 
     $this->callView($resource); 
     $this->callController($resource); 
     $this->callMigration($resource); 
     $this->callSeeder($resource); 
     $this->callMigrate(); 

     // All done! 
     $this->info(sprintf(
      "All done! Don't forget to add '%s` to %s." . PHP_EOL, 
      "Route::resource('{$this->getTableName($resource)}', '{$this->getControllerName($resource)}');", 
      "app/routes.php" 
     )); 

    } 

    /** 
    * Get the name for the model 
    * 
    * @param $resource 
    * @return string 
    */ 
    protected function getModelName($resource) 
    { 
     return ucwords(str_singular(camel_case($resource))); 
    } 

    /** 
    * Get the name for the controller 
    * 
    * @param $resource 
    * @return string 
    */ 
    protected function getControllerName($resource) 
    { 
     return ucwords(str_plural(camel_case($resource))) . 'Controller'; 
    } 

    /** 
    * Get the DB table name 
    * 
    * @param $resource 
    * @return string 
    */ 
    protected function getTableName($resource) 
    { 
     return str_plural($resource); 
    } 

    /** 
    * Get the name for the migration 
    * 
    * @param $resource 
    * @return string 
    */ 
    protected function getMigrationName($resource) 
    { 
     return "create_" . str_plural($resource) . "_table"; 
    } 

    /** 
    * Call model generator if user confirms 
    * 
    * @param $resource 
    */ 
    protected function callModel($resource) 
    { 
     $modelName = $this->getModelName($resource); 

     // if ($this->confirm("Do you want me to create a $modelName model? [yes|no]")) 
     // { 
      $this->call('generate:model', compact('modelName')); 
     // } 
    } 

    /** 
    * Call view generator if user confirms 
    * 
    * @param $resource 
    */ 
    protected function callView($resource) 
    { 
     $collection = $this->getTableName($resource); 
     $modelName = $this->getModelName($resource); 

     // if ($this->confirm("Do you want me to create views for this $modelName resource? [yes|no]")) 
     // { 
      foreach(['index', 'show', 'create', 'edit'] as $viewName) 
      { 
       $viewName = "{$collection}.{$viewName}"; 

       $this->call('generate:view', compact('viewName')); 
      } 
     // } 
    } 

    /** 
    * Call controller generator if user confirms 
    * 
    * @param $resource 
    */ 
    protected function callController($resource) 
    { 
     $controllerName = $this->getControllerName($resource); 

     // if ($this->confirm("Do you want me to create a $controllerName controller? [yes|no]")) 
     // { 
      $this->call('generate:controller', compact('controllerName')); 
     // } 
    } 

    /** 
    * Call migration generator if user confirms 
    * 
    * @param $resource 
    */ 
    protected function callMigration($resource) 
    { 
     $migrationName = $this->getMigrationName($resource); 

     // if ($this->confirm("Do you want me to create a '$migrationName' migration and schema for this resource? [yes|no]")) 
     // { 
      $this->call('generate:migration', [ 
       'migrationName' => $migrationName, 
       '--fields' => $this->option('fields') 
      ]); 
     // } 
    } 

    /** 
    * Call seeder generator if user confirms 
    * 
    * @param $resource 
    */ 
    protected function callSeeder($resource) 
    { 
     $tableName = str_plural($this->getModelName($resource)); 

     // if ($this->confirm("Would you like a '$tableName' table seeder? [yes|no]")) 
     // { 
      $this->call('generate:seed', compact('tableName')); 
     // } 
    } 

    /** 
    * Migrate database if user confirms 
    */ 
    protected function callMigrate() 
    { 
     // if ($this->confirm('Do you want to go ahead and migrate the database? [yes|no]')) { 
      $this->call('migrate'); 
      $this->info('Done!'); 
     // } 
    } 

    /** 
    * Get the console command arguments. 
    * 
    * @return array 
    */ 
    protected function getArguments() 
    { 
     return [ 
      ['resource', InputArgument::REQUIRED, 'Singular resource name'] 
     ]; 
    } 

    /** 
    * Get the console command options. 
    * 
    * @return array 
    */ 
    protected function getOptions() 
    { 
     return [ 
      ['fields', null, InputOption::VALUE_OPTIONAL, 'Fields for the migration'] 
     ]; 
    } 

} 

試現在再來! 希望對你有所幫助!