コード例 #1
0
 /**
  * Generate the file.
  *
  * @param string $name
  * @param string $service
  * @return Request|bool
  * @throws Exception
  */
 public function generate($name, $service)
 {
     $request = Str::request($name);
     $service = Str::service($service);
     $path = $this->findRequestPath($service, $request);
     if ($this->exists($path)) {
         throw new Exception('Request already exists');
         return false;
     }
     $namespace = $this->findRequestsNamespace($service);
     $content = file_get_contents($this->getStub());
     $content = str_replace(['{{request}}', '{{namespace}}', '{{foundation_namespace}}'], [$request, $namespace, $this->findFoundationNamespace()], $content);
     $this->createFile($path, $content);
     return new Request($request, $service, $namespace, basename($path), $path, $this->relativeFromReal($path), $content);
 }
コード例 #2
0
 /**
  * Parse the model name.
  *
  * @param string $name
  * @return string
  */
 public function parseRequestName($name)
 {
     return Str::request($name);
 }