|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Bantenprov\LaravelOpd; |
|
4
|
|
|
|
|
5
|
|
|
use Bantenprov\LaravelOpd\Models\LaravelOpdModel; |
|
6
|
|
|
use Illuminate\Http\Request; |
|
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* The LaravelOpd class. |
|
9
|
|
|
* |
|
10
|
|
|
* @package Bantenprov\LaravelOpd |
|
11
|
|
|
* @author bantenprov <[email protected]> |
|
12
|
|
|
*/ |
|
13
|
|
|
class LaravelOpd |
|
14
|
|
|
{ |
|
15
|
|
|
protected $opd_model; |
|
16
|
|
|
|
|
17
|
|
|
public function __construct() |
|
18
|
|
|
{ |
|
19
|
|
|
$this->opd_model = new LaravelOpdModel(); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function welcome() |
|
23
|
|
|
{ |
|
24
|
|
|
return 'Welcome to Bantenprov\LaravelOpd package'; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function index() |
|
28
|
|
|
{ |
|
29
|
|
|
return $opds = LaravelOpdModel::all(); |
|
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
//return view('unit_kerja.index',compact('opds')); |
|
32
|
|
|
|
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function tree() |
|
36
|
|
|
{ |
|
37
|
|
|
$nodes = LaravelOpdModel::get()->toTree(); |
|
38
|
|
|
|
|
39
|
|
View Code Duplication |
$traverse = function ($categories, $prefix = '-') use (&$traverse) { |
|
|
|
|
|
|
40
|
|
|
foreach ($categories as $category) { |
|
41
|
|
|
echo $prefix.' '.$category->kunker.' - '.$category->name.'<br>'; |
|
42
|
|
|
|
|
43
|
|
|
$traverse($category->children, $prefix.'-'); |
|
44
|
|
|
} |
|
45
|
|
|
}; |
|
46
|
|
|
|
|
47
|
|
|
return $traverse($nodes); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function createRoot() |
|
51
|
|
|
{ |
|
52
|
|
|
|
|
53
|
|
|
return view('unit_kerja.create-root'); |
|
|
|
|
|
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function createChild() |
|
57
|
|
|
{ |
|
58
|
|
|
return $unit_kerjas = LaravelOpdModel::all(); |
|
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
//return view('unit_kerja.create-child',compact('unit_kerjas')); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function addChild($id) |
|
64
|
|
|
{ |
|
65
|
|
|
return $unit_kerja = LaravelOpdModel::where('id',$id)->first(); |
|
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
//return view('unit_kerja.add-child',compact('unit_kerja')); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
View Code Duplication |
public function storeRoot($request = array()) |
|
|
|
|
|
|
71
|
|
|
{ |
|
72
|
|
|
$check_root = LaravelOpdModel::where('id',$request->root); |
|
73
|
|
|
|
|
74
|
|
|
if($check_root->first()->isEmpty()) |
|
75
|
|
|
{ |
|
76
|
|
|
|
|
77
|
|
|
$unit_kerja = LaravelOpdModel::create([ |
|
|
|
|
|
|
78
|
|
|
'kunker' => $request->kunker, |
|
79
|
|
|
'kunker_simral' => '', |
|
80
|
|
|
'name' => $request->name, |
|
81
|
|
|
'levelunker' => $request->levelunker, |
|
82
|
|
|
]); |
|
83
|
|
|
} |
|
84
|
|
|
else |
|
85
|
|
|
{ |
|
86
|
|
|
return redirect()->back(); |
|
|
|
|
|
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
|
|
90
|
|
|
|
|
91
|
|
|
return redirect()->back(); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
View Code Duplication |
public function storeChild($request = array()) |
|
|
|
|
|
|
95
|
|
|
{ |
|
96
|
|
|
$check_root = LaravelOpdModel::where('id',$request->root); |
|
97
|
|
|
|
|
98
|
|
|
$check_root->first()->children()->create([ |
|
99
|
|
|
'kunker' => $request->c_kunker, |
|
100
|
|
|
'kunker_simral' => '', |
|
101
|
|
|
'name' => $request->c_name, |
|
102
|
|
|
'levelunker' => $request->c_levelunker, |
|
103
|
|
|
]); |
|
104
|
|
|
|
|
105
|
|
|
return redirect()->back(); |
|
|
|
|
|
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|
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