|
@@ 48-58 (lines=11) @@
|
| 45 |
|
return $this->result; |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
public function generateResource() |
| 49 |
|
{ |
| 50 |
|
if (! file_exists(base_path('app/Http/Resources/'.$this->model.'Resource.php'))) { |
| 51 |
|
$template = self::getStubContents('resource.stub'); |
| 52 |
|
$template = str_replace('{{modelName}}', $this->model, $template); |
| 53 |
|
file_put_contents(base_path('app/Http/Resources/'.$this->model.'Resource.php'), $template); |
| 54 |
|
$this->result = true; |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
return $this->result; |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
public function generateCollection() |
| 61 |
|
{ |
|
@@ 60-70 (lines=11) @@
|
| 57 |
|
return $this->result; |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
public function generateCollection() |
| 61 |
|
{ |
| 62 |
|
if (! file_exists(base_path('app/Http/Resources/'.$this->model.'Collection.php'))) { |
| 63 |
|
$template = self::getStubContents('collection.stub'); |
| 64 |
|
$template = str_replace('{{modelName}}', $this->model, $template); |
| 65 |
|
file_put_contents(base_path('app/Http/Resources/'.$this->model.'Collection.php'), $template); |
| 66 |
|
$this->result = true; |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
return $this->result; |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
public function generateRoute() |
| 73 |
|
{ |