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