/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { $product = Product::find($this->input('id')); $updatedProduct = $this->input('all'); // if user role is manager and atr has changed - return 403 if (app('current_user_type') === 'manager' && $product->art !== $updatedProduct['art']) { return false; } return true; }
/** * Remove the specified product from storage. * * @param int $id * @return Response */ public function destroy($id) { $product = Product::find($id); $product->delete(); return redirect('products'); }