1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use Illuminate\Http\Request; |
6
|
|
|
use Auth; |
7
|
|
|
use App\Service; |
8
|
|
|
use App\Http\Requests; |
9
|
|
|
use App\Http\Controllers\Controller; |
10
|
|
|
use Lubus\Constants\Status; |
|
|
|
|
11
|
|
|
|
12
|
|
|
class ServicesController 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
|
|
|
$services = Service::search('"'.$request->input('search').'"')->paginate(10); |
26
|
|
|
$serviceTotal = Service::search('"'.$request->input('search').'"')->get(); |
27
|
|
|
$count = $serviceTotal->count(); |
28
|
|
|
|
29
|
|
|
return view('services.index', compact('services','count')); |
|
|
|
|
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Display the specified resource. |
34
|
|
|
* |
35
|
|
|
* @param int $id |
36
|
|
|
* @return Response |
37
|
|
|
*/ |
38
|
|
|
public function show() |
39
|
|
|
{ |
40
|
|
|
$service = Service::findOrFail($id); |
|
|
|
|
41
|
|
|
|
42
|
|
|
return view('services.show', compact('service')); |
|
|
|
|
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('services.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, ['name' => 'unique:mst_services,name']); |
64
|
|
|
|
65
|
|
|
$service = new Service($request->all()); |
66
|
|
|
|
67
|
|
|
$service->createdBy()->associate(Auth::user()); |
68
|
|
|
$service->updatedBy()->associate(Auth::user()); |
69
|
|
|
|
70
|
|
|
$service->save(); |
71
|
|
|
|
72
|
|
|
flash()->success('Service was successfully created'); |
73
|
|
|
|
74
|
|
|
return redirect('plans/services/all'); |
|
|
|
|
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
public function edit($id) |
78
|
|
|
{ |
79
|
|
|
$service = Service::findOrFail($id); |
80
|
|
|
|
81
|
|
|
return view('services.edit', compact('service')); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function update($id, Request $request) |
85
|
|
|
{ |
86
|
|
|
|
87
|
|
|
$service = Service::findOrFail($id); |
88
|
|
|
|
89
|
|
|
$service->update($request->all()); |
90
|
|
|
$service->updatedBy()->associate(Auth::user()); |
91
|
|
|
$service->save(); |
92
|
|
|
flash()->success('Service details were successfully updated'); |
93
|
|
|
return redirect('plans/services/all'); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
public function delete($id) |
97
|
|
|
{ |
98
|
|
|
Service::destroy($id); |
99
|
|
|
|
100
|
|
|
return redirect('plans/services/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