1
|
|
|
<?php namespace App\Http\Controllers\Backend; |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* ContentGroupController |
5
|
|
|
* |
6
|
|
|
* This is the controller of the content groups of the shop |
7
|
|
|
* @author Matthijs Neijenhuijs <[email protected]> |
8
|
|
|
* @version 0.1 |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
use App\Http\Controllers\Controller; |
12
|
|
|
use Illuminate\Http\Request; |
13
|
|
|
use Notification; |
14
|
|
|
use Datatables; |
|
|
|
|
15
|
|
|
use Form; |
16
|
|
|
|
17
|
|
|
use Hideyo\Ecommerce\Framework\Services\Content\ContentFacade as ContentService; |
18
|
|
|
|
19
|
|
|
class ContentGroupController extends Controller |
20
|
|
|
{ |
21
|
|
|
public function index(Request $request) |
22
|
|
|
{ |
23
|
|
|
if ($request->wantsJson()) { |
24
|
|
|
|
25
|
|
|
$query = ContentService::getGroupModel() |
26
|
|
|
->select(['id', 'title']) |
27
|
|
|
->where('shop_id', '=', auth('hideyobackend')->user()->selected_shop_id); |
|
|
|
|
28
|
|
|
|
29
|
|
|
$datatables = Datatables::of($query) |
30
|
|
|
->addColumn('action', function ($query) { |
31
|
|
|
$deleteLink = Form::deleteajax(url()->route('content-group.destroy', $query->id), 'Delete', '', array('class'=>'btn btn-default btn-sm btn-danger')); |
32
|
|
|
$links = '<a href="'.url()->route('content-group.edit', $query->id).'" class="btn btn-default btn-sm btn-success"><i class="entypo-pencil"></i>Edit</a> '.$deleteLink; |
33
|
|
|
|
34
|
|
|
return $links; |
35
|
|
|
}); |
36
|
|
|
|
37
|
|
|
return $datatables->make(true); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
return view('backend.content_group.index')->with('contentGroup', ContentService::selectAll()); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function create() |
44
|
|
|
{ |
45
|
|
|
return view('backend.content_group.create')->with(array()); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function store(Request $request) |
49
|
|
|
{ |
50
|
|
|
$result = ContentService::createGroup($request->all()); |
51
|
|
|
return ContentService::notificationRedirect('content-group.index', $result, 'The content group was inserted.'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function edit($contentGroupId) |
55
|
|
|
{ |
56
|
|
|
return view('backend.content_group.edit')->with(array('contentGroup' => ContentService::findGroup($contentGroupId))); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function update(Request $request, $contentGroupId) |
60
|
|
|
{ |
61
|
|
|
$result = ContentService::updateGroupById($request->all(), $contentGroupId); |
62
|
|
|
return ContentService::notificationRedirect('content-group.index', $result, 'The content group was updated.'); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Remove the specified resource from storage |
67
|
|
|
* @param int $contentGroupId |
68
|
|
|
* @return Redirect |
69
|
|
|
*/ |
70
|
|
|
public function destroy($contentGroupId) |
71
|
|
|
{ |
72
|
|
|
$result = ContentService::destroyGroup($contentGroupId); |
73
|
|
|
|
74
|
|
|
if ($result) { |
75
|
|
|
Notification::success('The content was deleted.'); |
76
|
|
|
return redirect()->route('content-group.index'); |
|
|
|
|
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
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