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