1
|
|
|
<?php |
2
|
|
|
namespace Bantenprov\LaravelOpd\Http\Controllers; |
3
|
|
|
|
4
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
|
|
|
|
6
|
|
|
use Bantenprov\LaravelOpd\Facades\LaravelOpd; |
7
|
|
|
use Bantenprov\LaravelOpd\Models\LaravelOpdModel; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* The LaravelOpdController class. |
11
|
|
|
* |
12
|
|
|
* @package Bantenprov\LaravelOpd |
13
|
|
|
* @author bantenprov <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
class LaravelOpdController extends Controller |
16
|
|
|
{ |
17
|
|
|
public function demo() |
18
|
|
|
{ |
19
|
|
|
return LaravelOpd::welcome(); |
|
|
|
|
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function index() |
23
|
|
|
{ |
24
|
|
|
|
25
|
|
|
$opds = LaravelOpdModel::orderBy('kunker','asc')->get(); |
26
|
|
|
|
27
|
|
|
$nodes = LaravelOpdModel::get()->toTree(); |
28
|
|
|
|
29
|
|
View Code Duplication |
$traverse = function ($categories, $prefix = '-') use (&$traverse) { |
|
|
|
|
30
|
|
|
foreach ($categories as $category) { |
31
|
|
|
echo $prefix.' '.$category->kunker.' - '.$category->name.'<br>'; |
32
|
|
|
|
33
|
|
|
$traverse($category->children, $prefix.'-'); |
34
|
|
|
} |
35
|
|
|
}; |
36
|
|
|
|
37
|
|
|
$traverse($nodes); |
38
|
|
|
|
39
|
|
|
|
40
|
|
|
return view('laravel-opd::unit_kerja.index',compact('opds')); |
|
|
|
|
41
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function createRoot() |
45
|
|
|
{ |
46
|
|
|
|
47
|
|
|
return view('laravel-opd::unit_kerja.create-root'); |
|
|
|
|
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function createChild() |
51
|
|
|
{ |
52
|
|
|
$unit_kerjas = LaravelOpdModel::all(); |
53
|
|
|
|
54
|
|
|
return view('laravel-opd::unit_kerja.create-child',compact('unit_kerjas')); |
|
|
|
|
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function addChild($id) |
58
|
|
|
{ |
59
|
|
|
$unit_kerja = LaravelOpdModel::where('id',$id)->first(); |
60
|
|
|
|
61
|
|
|
return view('laravel-opd::unit_kerja.add-child',compact('unit_kerja')); |
|
|
|
|
62
|
|
|
} |
63
|
|
|
|
64
|
|
View Code Duplication |
public function storeRoot(Request $request) |
|
|
|
|
65
|
|
|
{ |
66
|
|
|
$check_root = LaravelOpdModel::where('id',$request->root); |
67
|
|
|
|
68
|
|
|
if($check_root->get()->isEmpty()) |
69
|
|
|
{ |
70
|
|
|
$unit_kerja = LaravelOpdModel::create([ |
|
|
|
|
71
|
|
|
'kunker' => $request->kunker, |
72
|
|
|
'kunker_sinjab' => '', |
73
|
|
|
'kunker_simral' => '', |
74
|
|
|
'kunker_sinjab' => '', |
75
|
|
|
'name' => $request->name, |
76
|
|
|
'levelunker' => $request->levelunker, |
77
|
|
|
'njab' => $request->njab, |
78
|
|
|
'npej' => $request->npej |
79
|
|
|
]); |
80
|
|
|
} |
81
|
|
|
else |
82
|
|
|
{ |
83
|
|
|
return redirect()->back(); |
|
|
|
|
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
return redirect()->back(); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
public function storeChild(Request $request) |
90
|
|
|
{ |
91
|
|
|
$check_root = LaravelOpdModel::where('id',$request->root); |
92
|
|
|
|
93
|
|
|
$check_root->first()->children()->create([ |
94
|
|
|
'kunker' => $request->c_kunker, |
95
|
|
|
'kunker_simral' => '', |
96
|
|
|
'kunker_sinjab' => '', |
97
|
|
|
'name' => $request->c_name, |
98
|
|
|
'levelunker' => $request->c_levelunker, |
99
|
|
|
'njab' => $request->c_njab, |
100
|
|
|
'npej' => $request->c_npej |
101
|
|
|
]); |
102
|
|
|
|
103
|
|
|
return redirect()->back(); |
|
|
|
|
104
|
|
|
} |
105
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths