Ejemplo n.º 1
0
 /**
  * Generate the file.
  *
  * @param $name
  * @return Model|bool
  * @throws Exception
  */
 public function generate($name)
 {
     $model = Str::model($name);
     $path = $this->findModelPath($model);
     if ($this->exists($path)) {
         throw new Exception('Model already exists');
         return false;
     }
     $namespace = $this->findModelNamespace();
     $content = file_get_contents($this->getStub());
     $content = str_replace(['{{model}}', '{{namespace}}', '{{foundation_namespace}}'], [$model, $namespace, $this->findFoundationNamespace()], $content);
     $this->createFile($path, $content);
     return new Model($model, $namespace, basename($path), $path, $this->relativeFromReal($path), $content);
 }
Ejemplo n.º 2
0
 /**
  * Parse the model name.
  *
  * @param string $name
  * @return string
  */
 public function parseModelName($name)
 {
     return Str::model($name);
 }