Skip to content

Commit 4f71252

Browse files
committed
1.5 finished
1 parent 049488a commit 4f71252

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This package requires the following dependencies:
3838
Via Composer
3939

4040
``` bash
41-
$ composer require timehunter/laravel-file-generator "^1.3.0"
41+
$ composer require timehunter/laravel-file-generator "^1.5.0"
4242
```
4343

4444
If your Laravel framework version <= 5.4, please register the service provider in your config file: /config/app.php, otherwise please skip it.

src/Services/AbstractFileGenerator.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,12 @@ public function getData()
4545

4646
public function checkDir($directory)
4747
{
48-
if (!app('files')->exists($directory)) {
49-
app('files')->makeDirectory($directory);
48+
//Check if the directory already exists.
49+
if(!is_dir($directory)){
50+
//Directory does not exist, so lets create it.
51+
mkdir($directory, 0755, true);
5052
}
53+
5154
}
5255

5356
public function publish()
@@ -96,6 +99,7 @@ abstract public function getTemplateData();
9699

97100
public function prepareView()
98101
{
102+
99103
$prepare = app('view')->make($this->getTemplateView(), ['data' => $this->templateData])->render();
100104

101105
$final = app('view')->make($this->getMainView(), ['data' => $prepare, 'header' => '<?php'])->render();

templates/class.blade.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use {{$use}};
55
@endforeach
66

7-
{{$data['class_type']}} {{$data['class_name']}} extends {{$data['extends']}} implements @foreach($data['implements'] as $key =>$implement)@if(count($data['implements']) === $key+1){{$implement}} @else{{$implement}},@endif @endforeach
7+
{{$data['class_type']}} {{$data['class_name']}} @if($data['extends'])extends @endif{{$data['extends']}} @if($data['implements'])implements @foreach($data['implements'] as $key =>$implement)@if(count($data['implements']) === $key+1){{$implement}} @else{{$implement}},@endif @endforeach @endif
88

99
{
1010
@foreach($data['traits'] as $trait)
@@ -16,10 +16,7 @@
1616
@endforeach
1717

1818
@foreach($data['functions'] as $function)
19-
{{$function}}
20-
{
21-
22-
}
19+
{!! $function !!}
2320

2421
@endforeach
2522
}

templates/interface.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ interface {{$data['interface_name']}}
44

55
{
66
@foreach($data['functions'] as $function)
7-
{{$function}};
7+
{!! $function !!};
88

99
@endforeach
1010
}

templates/main.blade.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{!! $header!!}
22

3-
{!! $data !!}
3+
{!! $data !!}
4+

0 commit comments

Comments
 (0)