@@ -11,8 +11,9 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function authorize() |
| 13 | 13 | { |
| 14 | - if(! Auth::user()->confirmed) |
|
| 15 | - return true; |
|
| 14 | + if(! Auth::user()->confirmed) { |
|
| 15 | + return true; |
|
| 16 | + } |
|
| 16 | 17 | |
| 17 | 18 | return false; |
| 18 | 19 | } |
@@ -15,9 +15,10 @@ |
||
| 15 | 15 | |
| 16 | 16 | if ($involve |
| 17 | 17 | && $this->getInvolvedRepository()->checkIfAuthInvolved($involve->product) |
| 18 | - ) |
|
| 19 | - if ($involve->active !== 0) { |
|
| 18 | + ) { |
|
| 19 | + if ($involve->active !== 0) { |
|
| 20 | 20 | return true; |
| 21 | + } |
|
| 21 | 22 | } |
| 22 | 23 | |
| 23 | 24 | return false; |
@@ -87,13 +87,14 @@ discard block |
||
| 87 | 87 | 'data' => function () use ($category_1){ |
| 88 | 88 | $products = []; |
| 89 | 89 | |
| 90 | - if($category_1) |
|
| 91 | - $category_1->categoryables() |
|
| 90 | + if($category_1) { |
|
| 91 | + $category_1->categoryables() |
|
| 92 | 92 | ->active() |
| 93 | 93 | ->elementType(get_class($this->products->getModel())) |
| 94 | 94 | ->get() |
| 95 | 95 | ->each(function ($morph) use (&$products) { |
| 96 | 96 | $products[] = $morph->categoryable; |
| 97 | + } |
|
| 97 | 98 | }); |
| 98 | 99 | |
| 99 | 100 | return $products; |
@@ -104,13 +105,14 @@ discard block |
||
| 104 | 105 | 'data' => function () use ($category_2){ |
| 105 | 106 | $products = []; |
| 106 | 107 | |
| 107 | - if($category_2) |
|
| 108 | - $category_2->categoryables() |
|
| 108 | + if($category_2) { |
|
| 109 | + $category_2->categoryables() |
|
| 109 | 110 | ->active() |
| 110 | 111 | ->elementType(get_class($this->products->getModel())) |
| 111 | 112 | ->get() |
| 112 | 113 | ->each(function ($morph) use (&$products) { |
| 113 | 114 | $products[] = $morph->categoryable; |
| 115 | + } |
|
| 114 | 116 | }); |
| 115 | 117 | |
| 116 | 118 | return $products; |
@@ -20,8 +20,9 @@ |
||
| 20 | 20 | $this->product = $request->route()->getParameter('product'); |
| 21 | 21 | $times = config('product.times'); |
| 22 | 22 | |
| 23 | - if ((!empty($times)) && ($this->getUserInvolvesTimes() < 3)) |
|
| 24 | - return $next($request); |
|
| 23 | + if ((!empty($times)) && ($this->getUserInvolvesTimes() < 3)) { |
|
| 24 | + return $next($request); |
|
| 25 | + } |
|
| 25 | 26 | |
| 26 | 27 | return redirect()->back()->withStatus('Sorry! But you can\'t involve this product.'); |
| 27 | 28 | } |
@@ -39,8 +39,9 @@ |
||
| 39 | 39 | { |
| 40 | 40 | if(Auth::check()) |
| 41 | 41 | { |
| 42 | - if(Auth::user()->confirmed) |
|
| 43 | - return $next($request); |
|
| 42 | + if(Auth::user()->confirmed) { |
|
| 43 | + return $next($request); |
|
| 44 | + } |
|
| 44 | 45 | |
| 45 | 46 | foreach ($this->excludeRoutes as $route) { |
| 46 | 47 | if($request->route()->getName() == $route) { |
@@ -17,9 +17,10 @@ |
||
| 17 | 17 | { |
| 18 | 18 | $subscribe = $request->route()->getParameter('unscribe'); |
| 19 | 19 | |
| 20 | - if($subscribe) |
|
| 21 | - |
|
| 20 | + if($subscribe) { |
|
| 21 | + |
|
| 22 | 22 | return $next($request); |
| 23 | + } |
|
| 23 | 24 | |
| 24 | 25 | abort('404', 'Invalid token'); |
| 25 | 26 | } |
@@ -50,9 +50,10 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function handle($request, Closure $next) |
| 52 | 52 | { |
| 53 | - foreach ($this->excludeRoutes as $route) |
|
| 54 | - if($request->route()->getName() == $route) |
|
| 53 | + foreach ($this->excludeRoutes as $route) { |
|
| 54 | + if($request->route()->getName() == $route) |
|
| 55 | 55 | return $next($request); |
| 56 | + } |
|
| 56 | 57 | |
| 57 | 58 | return parent::handle($request, $next); |
| 58 | 59 | } |
@@ -14,8 +14,9 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | public function handle($request, \Closure $next, $guard = null) |
| 16 | 16 | { |
| 17 | - if($request->ajax()) |
|
| 18 | - return $next($request); |
|
| 17 | + if($request->ajax()) { |
|
| 18 | + return $next($request); |
|
| 19 | + } |
|
| 19 | 20 | |
| 20 | 21 | abort('404'); |
| 21 | 22 | } |
@@ -72,8 +72,9 @@ |
||
| 72 | 72 | if (!is_null($product_id)) { |
| 73 | 73 | $this->cleanDraftedProduct(); |
| 74 | 74 | |
| 75 | - if ($product = $this->products->findDrafted($product_id)) |
|
| 76 | - $product->delete(); |
|
| 75 | + if ($product = $this->products->findDrafted($product_id)) { |
|
| 76 | + $product->delete(); |
|
| 77 | + } |
|
| 77 | 78 | } |
| 78 | 79 | } |
| 79 | 80 | } |