1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
6
|
|
|
use Auth; |
7
|
|
|
use App\Plan; |
8
|
|
|
use App\Http\Requests; |
9
|
|
|
use App\Http\Controllers\Controller; |
10
|
|
|
use Lubus\Constants\Status; |
|
|
|
|
11
|
|
|
|
12
|
|
|
class PlansController extends Controller |
13
|
|
|
{ |
14
|
|
|
public function __construct() |
15
|
|
|
{ |
16
|
|
|
$this->middleware('auth'); |
17
|
|
|
} |
18
|
|
|
/** |
19
|
|
|
* Display a listing of the resource. |
20
|
|
|
* |
21
|
|
|
* @return Response |
|
|
|
|
22
|
|
|
*/ |
23
|
|
|
public function index(Request $request) |
24
|
|
|
{ |
25
|
|
|
$plans = Plan::excludeArchive()->search('"'.$request->input('search').'"')->paginate(10); |
26
|
|
|
$planTotal = Plan::excludeArchive()->search('"'.$request->input('search').'"')->get(); |
27
|
|
|
$count = $planTotal->count(); |
28
|
|
|
|
29
|
|
|
return view('plans.index', compact('plans','count')); |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Display the specified resource. |
34
|
|
|
* |
35
|
|
|
* @param int $id |
36
|
|
|
* @return Response |
37
|
|
|
*/ |
38
|
|
|
public function show() |
39
|
|
|
{ |
40
|
|
|
$plan = Plan::findOrFail($id); |
|
|
|
|
41
|
|
|
|
42
|
|
|
return view('plans.show', compact('plan')); |
|
|
|
|
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Show the form for creating a new resource. |
47
|
|
|
* |
48
|
|
|
* @return Response |
49
|
|
|
*/ |
50
|
|
|
public function create() |
51
|
|
|
{ |
52
|
|
|
return view('plans.create'); |
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Store a newly created resource in storage. |
57
|
|
|
* |
58
|
|
|
* @return Response |
59
|
|
|
*/ |
60
|
|
|
public function store(Request $request) |
61
|
|
|
{ |
62
|
|
|
//Model Validation |
63
|
|
|
$this->validate($request, ['plan_code' => 'unique:mst_plans,plan_code', |
64
|
|
|
'plan_name' => 'unique:mst_plans,plan_name']); |
65
|
|
|
|
66
|
|
|
$plan = new Plan($request->all()); |
67
|
|
|
|
68
|
|
|
$plan->createdBy()->associate(Auth::user()); |
69
|
|
|
$plan->updatedBy()->associate(Auth::user()); |
70
|
|
|
|
71
|
|
|
$plan->save(); |
72
|
|
|
|
73
|
|
|
flash()->success('Plan was successfully created'); |
74
|
|
|
|
75
|
|
|
return redirect('plans'); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function edit($id) |
79
|
|
|
{ |
80
|
|
|
$plan=Plan::findOrFail($id); |
81
|
|
|
|
82
|
|
|
return view('plans.edit', compact('plan')); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function update($id, Request $request) |
86
|
|
|
{ |
87
|
|
|
|
88
|
|
|
$plan=Plan::findOrFail($id); |
89
|
|
|
|
90
|
|
|
$plan->update($request->all()); |
91
|
|
|
$plan->updatedBy()->associate(Auth::user()); |
92
|
|
|
$plan->save(); |
93
|
|
|
flash()->success('Plan details were successfully updated'); |
94
|
|
|
return redirect('plans/all'); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function archive($id) |
98
|
|
|
{ |
99
|
|
|
Plan::destroy($id); |
100
|
|
|
return redirect('plans/all'); |
101
|
|
|
} |
102
|
|
|
} |
103
|
|
|
|
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