PHP Class Appzcoder\CrudGenerator\Commands\CrudModelCommand

Inheritance: extends Illuminate\Console\GeneratorCommand
Show file Open project: appzcoder/crud-generator

Protected Properties

Property Type Description
$description string The console command description.
$signature string The name and signature of the console command.
$type string The type of class being generated.

Protected Methods

Method Description
buildClass ( string $name ) : string Build the model class with the given name.
createRelationshipFunction ( string &$stub, string $relationshipName, string $relationshipType, $argsString ) Create the code for a model relationship
getDefaultNamespace ( string $rootNamespace ) : string Get the default namespace for the class.
getStub ( ) : string Get the stub file for the generator.
replaceFillable ( string &$stub, string $fillable ) Replace the fillable for the given stub.
replacePrimaryKey ( string &$stub, string $primaryKey ) Replace the primary key for the given stub.
replaceRelationshipPlaceholder ( &$stub ) remove the relationships placeholder when it's no longer needed
replaceTable ( string &$stub, string $table ) Replace the table for the given stub.

Method Details

buildClass() protected method

Build the model class with the given name.
protected buildClass ( string $name ) : string
$name string
return string

createRelationshipFunction() protected method

Create the code for a model relationship
protected createRelationshipFunction ( string &$stub, string $relationshipName, string $relationshipType, $argsString )
$stub string
$relationshipName string the name of the function, e.g. owners
$relationshipType string the type of the relationship, hasOne, hasMany, belongsTo etc

getDefaultNamespace() protected method

Get the default namespace for the class.
protected getDefaultNamespace ( string $rootNamespace ) : string
$rootNamespace string
return string

getStub() protected method

Get the stub file for the generator.
protected getStub ( ) : string
return string

replaceFillable() protected method

Replace the fillable for the given stub.
protected replaceFillable ( string &$stub, string $fillable )
$stub string
$fillable string

replacePrimaryKey() protected method

Replace the primary key for the given stub.
protected replacePrimaryKey ( string &$stub, string $primaryKey )
$stub string
$primaryKey string

replaceRelationshipPlaceholder() protected method

remove the relationships placeholder when it's no longer needed
protected replaceRelationshipPlaceholder ( &$stub )
$stub

replaceTable() protected method

Replace the table for the given stub.
protected replaceTable ( string &$stub, string $table )
$stub string
$table string

Property Details

$description protected property

The console command description.
protected string $description
return string

$signature protected property

The name and signature of the console command.
protected string $signature
return string

$type protected property

The type of class being generated.
protected string $type
return string