PHP Class Iber\Generator\Commands\MakeModelsCommand

Inheritance: extends Illuminate\Console\GeneratorCommand
Show file 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 property

protected string $databaseEngine
return string

$description protected property

The console command description.
protected string $description
return string

$extends protected property

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

$fillableRules protected property

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

$getFunctionStub protected property

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

$guardedRules protected property

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

$name protected property

The console command name.
protected string $name
return string

$namespace protected property

Default model namespace.
protected string $namespace
return string

$ruleProcessor protected property

Rule processor class instance.
protected $ruleProcessor

$setFunctionStub protected property

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

$timestampRules protected property

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