/**
  * Replace all stub tokens with properties.
  *
  * @param $name
  * @param $table
  *
  * @return mixed|string
  */
 protected function replaceTokens($name, $table)
 {
     $class = $this->buildClass($name);
     $properties = $this->getTableProperties($table);
     $namespace = $this->getAppNamespace();
     $class = str_replace('{{namespace}}', $namespace, $class);
     $class = str_replace('{{class}}', $name, $class);
     $class = str_replace('{{extends}}', $this->option('extends'), $class);
     $class = str_replace('{{fillable}}', 'protected $fillable = ' . VariableConversion::convertArrayToString($properties['fillable']) . ';', $class);
     $class = str_replace('{{guarded}}', 'protected $guarded = ' . VariableConversion::convertArrayToString($properties['guarded']) . ';', $class);
     $class = str_replace('{{timestamps}}', 'public $timestamps = ' . VariableConversion::convertBooleanToString($properties['timestamps']) . ';', $class);
     $class = str_replace('{{table}}', 'public $table = "' . $table . '";', $class);
     if ($this->option("getset")) {
         $class = $this->replaceTokensWithSetGetFunctions($properties, $class);
     } else {
         $class = str_replace(["{{setters}}\n\n", "{{getters}}\n\n"], '', $class);
     }
     return $class;
 }
 /**
  * Replace all stub tokens with properties.
  *
  * @param $name
  * @param $table
  *
  * @return mixed|string
  */
 protected function replaceTokens($name, $table)
 {
     $class = $this->buildClass($name);
     $properties = $this->getTableProperties($table);
     $class = str_replace('{{extends}}', $this->option('extends'), $class);
     $class = str_replace('{{fillable}}', 'protected $fillable = ' . VariableConversion::convertArrayToString($properties['fillable']) . ';', $class);
     $class = str_replace('{{guarded}}', 'protected $guarded = ' . VariableConversion::convertArrayToString($properties['guarded']) . ';', $class);
     $class = str_replace('{{timestamps}}', 'public $timestamps = ' . VariableConversion::convertBooleanToString($properties['timestamps']) . ';', $class);
     return $class;
 }
 /**
  * Replace all stub tokens with properties.
  *
  * @param $name
  * @param $table
  *
  * @return mixed|string
  */
 protected function replaceTokens($name, $table)
 {
     $class = $this->buildClass($name);
     $properties = $this->getTableProperties($table);
     $extends = $this->option('extends');
     $class = str_replace('{{table}}', 'protected $table = \'' . $table . '\';', $class);
     $class = str_replace('{{primaryKey}}', $properties['primaryKey'] ? 'protected $primaryKey = \'' . $properties['primaryKey'] . '\';' . "\r\n\r\n\\    " : '', $class);
     $class = str_replace('{{extends}}', $extends, $class);
     $class = str_replace('{{shortNameExtends}}', explode('\\', $extends)[count(explode('\\', $extends)) - 1], $class);
     $class = str_replace('{{fillable}}', 'protected $fillable = ' . VariableConversion::convertArrayToString($properties['fillable']) . ';', $class);
     $class = str_replace('{{guarded}}', 'protected $guarded = ' . VariableConversion::convertArrayToString($properties['guarded']) . ';', $class);
     $class = str_replace('{{timestamps}}', 'public $timestamps = ' . VariableConversion::convertBooleanToString($properties['timestamps']) . ';', $class);
     if ($this->option("getset")) {
         $class = $this->replaceTokensWithSetGetFunctions($properties, $class);
     } else {
         $class = str_replace(["{{setters}}\n\n", "{{getters}}\n\n"], '', $class);
     }
     return $class;
 }