Nwidart\Modules\Support\Migrations\NameParser::getTableName PHP Method

getTableName() public method

Get the table will be used.
public getTableName ( ) : string
return string
    public function getTableName()
    {
        $matches = array_reverse($this->getMatches());
        return array_shift($matches);
    }

Usage Example

 /**
  * @throws \InvalidArgumentException
  *
  * @return mixed
  */
 protected function getTemplateContents()
 {
     $parser = new NameParser($this->argument('name'));
     if ($parser->isCreate()) {
         return Stub::create('/migration/create.stub', ['class' => $this->getClass(), 'table' => $parser->getTableName(), 'fields' => $this->getSchemaParser()->render()]);
     } elseif ($parser->isAdd()) {
         return Stub::create('/migration/add.stub', ['class' => $this->getClass(), 'table' => $parser->getTableName(), 'fields_up' => $this->getSchemaParser()->up(), 'fields_down' => $this->getSchemaParser()->down()]);
     } elseif ($parser->isDelete()) {
         return Stub::create('/migration/delete.stub', ['class' => $this->getClass(), 'table' => $parser->getTableName(), 'fields_down' => $this->getSchemaParser()->up(), 'fields_up' => $this->getSchemaParser()->down()]);
     } elseif ($parser->isDrop()) {
         return Stub::create('/migration/drop.stub', ['class' => $this->getClass(), 'table' => $parser->getTableName(), 'fields' => $this->getSchemaParser()->render()]);
     }
     return Stub::create('/migration/plain.stub', ['class' => $this->getClass()]);
 }
All Usage Examples Of Nwidart\Modules\Support\Migrations\NameParser::getTableName