PHP Class Iber\Generator\Commands\MakeModelsCommand

Inheritance: extends Illuminate\Console\GeneratorCommand
Datei anzeigen Open project: ignasbernotas/laravel-model-generator

Protected Properties

Property Type Description
$databaseEngine string
$description string The console command description.
$extends string Default class the model extends.
$fillableRules array Rules for columns that go into the fillable list.
$getFunctionStub string Contains the template stub for get function
$guardedRules array Rules for columns that go into the guarded list.
$name string The console command name.
$namespace string Default model namespace.
$ruleProcessor Rule processor class instance.
$setFunctionStub string Contains the template stub for set function
$timestampRules array Rules for columns that set whether the timestamps property is set to true/false.

Public Methods

Method Description
fire ( ) : mixed Execute the console command.
getStub ( ) : string Get stub file location.

Protected Methods

Method Description
generateTable ( $table ) : void Generate a model file from a database table.
getArguments ( ) : array Get the console command arguments.
getOptions ( ) : array Get the console command options.
getSchemaTables ( ) : array Get schema tables.
getTableColumns ( $table ) : array Get table columns.
getTablePrimaryKey ( $table ) : string Get table primary key column.
getTableProperties ( $table ) : array Fill up $fillable/$guarded/$timestamps properties based on table columns.
replaceTokens ( $name, $table ) : mixed | string Replace all stub tokens with properties.
replaceTokensWithSetGetFunctions ( array $properties, string $class ) : string Replaces setters and getters from the stub. The functions are created from provider properties.

Method Details

fire() public method

Execute the console command.
public fire ( ) : mixed
return mixed

generateTable() protected method

Generate a model file from a database table.
protected generateTable ( $table ) : void
$table
return void

getArguments() protected method

Get the console command arguments.
protected getArguments ( ) : array
return array

getOptions() protected method

Get the console command options.
protected getOptions ( ) : array
return array

getSchemaTables() protected method

Get schema tables.
protected getSchemaTables ( ) : array
return array

getStub() public method

Get stub file location.
public getStub ( ) : string
return string

getTableColumns() protected method

Get table columns.
protected getTableColumns ( $table ) : array
$table
return array

getTablePrimaryKey() protected method

Get table primary key column.
protected getTablePrimaryKey ( $table ) : string
$table
return string

getTableProperties() protected method

Fill up $fillable/$guarded/$timestamps properties based on table columns.
protected getTableProperties ( $table ) : array
$table
return array

replaceTokens() protected method

Replace all stub tokens with properties.
protected replaceTokens ( $name, $table ) : mixed | string
$name
$table
return mixed | string

replaceTokensWithSetGetFunctions() protected method

Replaces setters and getters from the stub. The functions are created from provider properties.
protected replaceTokensWithSetGetFunctions ( array $properties, string $class ) : string
$properties array
$class string
return string

Property Details

$databaseEngine protected_oe property

protected string $databaseEngine
return string

$description protected_oe property

The console command description.
protected string $description
return string

$extends protected_oe property

Default class the model extends.
protected string $extends
return string

$fillableRules protected_oe property

Rules for columns that go into the fillable list.
protected array $fillableRules
return array

$getFunctionStub protected_oe property

Contains the template stub for get function
protected string $getFunctionStub
return string

$guardedRules protected_oe property

Rules for columns that go into the guarded list.
protected array $guardedRules
return array

$name protected_oe property

The console command name.
protected string $name
return string

$namespace protected_oe property

Default model namespace.
protected string $namespace
return string

$ruleProcessor protected_oe property

Rule processor class instance.
protected $ruleProcessor

$setFunctionStub protected_oe property

Contains the template stub for set function
protected string $setFunctionStub
return string

$timestampRules protected_oe property

Rules for columns that set whether the timestamps property is set to true/false.
protected array $timestampRules
return array