packages/serbinario/l5scaffold/src/Console/Commands/CrudRepositoryCommand.php
/**
     * Execute the console command.
     *
     * @return mixed
     */
Execute the console command.
@return mixed
Execute the console command . @return mixed
public function handle()
    {
        $tableName = strtolower($this->argument('table-name'));
        $modelName = $this->option('model-name');
        Generic::setFilePath($this->getStub());
        Generic::setReplacements(['NAMESPACE' => app()->getNamespace()]);
        Generic::setReplacements(['CLASS' => Generic::ucWords($modelName)]);
        Generic::write(Generic::getContents(Generic::getReplacements()), $this->pathValidators, "Repository");
        RepositoryEloquent
        Generic::setFilePath($this->getStubRep());
        Generic::setReplacements(['NAMESPACE' => app()->getNamespace()]);
        Generic::setReplacements(['CLASS' => Generic::ucWords($modelName)]);
        Generic::write(Generic::getContents(Generic::getReplacements()), $this->pathValidators, "RepositoryEloquent");
        $this->SetRepository($modelName);
    }
public function handle ( ) { $ tableName = strtolower ( $ this -> argument ( 'table-name' ) ) ; $ modelName = $ this -> option ( 'model-name' ) ; Generic :: setFilePath ( $ this -> getStub ( ) ) ; Generic :: setReplacements ( [ 'NAMESPACE' => app ( ) -> getNamespace ( ) ] ) ; Generic :: setReplacements ( [ 'CLASS' => Generic :: ucWords ( $ modelName ) ] ) ; Generic :: write ( Generic :: getContents ( Generic :: getReplacements ( ) ) , $ this -> pathValidators , " Repository " ) ; Generic :: setFilePath ( $ this -> getStubRep ( ) ) ; Generic :: setReplacements ( [ 'NAMESPACE' => app ( ) -> getNamespace ( ) ] ) ; Generic :: setReplacements ( [ 'CLASS' => Generic :: ucWords ( $ modelName ) ] ) ; Generic :: write ( Generic :: getContents ( Generic :: getReplacements ( ) ) , $ this -> pathValidators , " RepositoryEloquent " ) ; $ this -> SetRepository ( $ modelName ) ; }
Execute the console command.
Execute the console command .
//Retorna namespace //dd(app()->getNamespace()); //Seto o caminho e o nome do arquivo modelo //Seto o caminho e o nome do arquivo modeloRepositoryEloquent //Adiciona ao arquivo SeracademicoRepositoryProvider.php os repositories