| 1 |  |  | <?php namespace App\Http\Controllers\Backend; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * ProductRelatedProductController | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * This is the controller of the product related products of the shop | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @author Matthijs Neijenhuijs <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * @version 0.1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use App\Http\Controllers\Controller; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Hideyo\Ecommerce\Framework\Services\Product\ProductFacade as ProductService; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use Hideyo\Ecommerce\Framework\Services\Product\ProductRelatedProductFacade as ProductRelatedProductService; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Illuminate\Http\Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use Notification; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | class ProductRelatedProductController extends Controller | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     public function index(Request $request, $productId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         $product = ProductService::find($productId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         if ($request->wantsJson()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |             $query = ProductRelatedProductService::getModel()->where('product_id', '=', $productId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |              | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |             $datatables = \Datatables::of($query) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |                 ->addColumn('related', function ($query) use ($productId) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |                     return $query->RelatedProduct->title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |                 }) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |                 ->addColumn('product', function ($query) use ($productId) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |                     return $query->Product->title; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |                 }) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |                 ->addColumn('action', function ($query) use ($productId) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |                     $deleteLink = \Form::deleteajax(url()->route('product.related-product.destroy', array('productId' => $productId, 'id' => $query->id)), 'Delete', '', array('class'=>'btn btn-default btn-sm btn-danger')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |                      | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |                     return $deleteLink; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |                 }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |                 return $datatables->make(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         return view('backend.product_related_product.index')->with(array('product' => $product)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     public function create($productId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         $product = ProductService::find($productId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         $products = ProductService::selectAll()->pluck('title', 'id'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         return view('backend.product_related_product.create')->with(array('products' => $products, 'product' => $product)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |      | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     public function store(Request $request, $productId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         $result  = ProductRelatedProductService::create($request->all(), $productId); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         return redirect()->route('product.related-product.index', $productId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |     public function destroy($productId, $productRelatedProductId) | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |         $result  = ProductRelatedProductService::destroy($productRelatedProductId); | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |         if ($result) { | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |             Notification::success('The related product is deleted.'); | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |             return redirect()->route('product.related-product.index', $productId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 71 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 72 |  |  |  | 
            
                        
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