can anyone help me with this error? my project is working fine on local server but when I push to heroku it gives me the below error. Any help ?
I am using php version 7.3.7
and laravel version 6.18.3
also I am using heroku for the first time. I have uploaded the code
**Product View**
@foreach($products as $p)
<section class="section single-wrap">
<div class="container">
<div class="page-title">
<div class="row">
<div class="col-sx-12 text-center">
<h3></h3>
</div>
</div>
</div>
<div class="content-top">
<div class="row">
<div class="col-sx-6 col-sm-6">
</div>
<div class="col-sm-6 col-xs-12 cen-xs text-right">
<div class="bread">
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="#">Shop</a></li>
<li class="active"></li>
</ol>
</div>
</div>
</div><!-- end row -->
</div><!-- end content top -->
<div class="row">
<div id="singlewrapper" class="col-md-8">
<div class="content nopad">
<div class="item-single-wrapper">
<div class="item-box">
<div class="item-media text-center">
<div id="slider" class="flexslider clearfix">
<ul class="slides">
<li><img src="" style="width:700px; height:400px;" alt="" class="img-responsive"></li>
</ul>
</div>
<div id="carousel" class="flexslider clearfix">
<ul class="slides">
<li>
@foreach (json_decode($p->filename) as $picture)
<img src="" style="height:120px; width:200px"/>
@endforeach
</li>
</ul>
</div>
</div><!-- end item-media -->
<div class="item-desc">
<b>Description</b>
<p> </p>
</div><!-- end item-desc -->
<center>
<p>__________</p>
</center>
@if(count($comments)>0)
<div class="item-desc">
<b>Comments</b>
@foreach($comments as $c)
<p> </p>
<h6> by <b></b> at <b></b> </h6> <br/>
@endforeach
</div><!-- end item-desc -->
@else
<div class="item-desc">
<b>Comments</b>
<p> No comments found </p>
</div><!-- end item-desc -->
@endif
</div><!-- end item-box -->
</div><!-- end item-single-wrapper -->
</div><!-- end content -->
</div><!-- end singlewrapper -->
<div id="sidebar" class="col-md-4">
<div class="boxes boxs">
<div class="item-price text-center">
<p>$</p>
<em><a href="#">Regular License</a></em>
<!-- <div class="rating">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
</div> -->
<hr>
<small>
@if((Auth::check()) && ($findLikes == true))
<a href="/unlike-product/" id="myNumber" name="likes" value="0" onclick="myFunction()"><i class="fa fa-heart-o"></i> UnLike</a> </small>
@else
<a href="/liked-product/" id="myNumber" name="likes" value="1" onclick="myFunction()"><i class="fa fa-heart-o"></i> Like it</a> </small>
@endif
<hr>
<a href="/add-to-cart/" class="btn btn-primary">Add to Cart</a>
<button type="button" data-toggle="modal" data-target="#myModal">Comment</button></a>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Add your comments here <span class="fa fa-comment"></span></h4>
</div>
<div class="modal-body">
<div class="login-form">
<form method="post" action="/product-comment/">
@csrf
<div class="form-group">
<input type="text" name="comment" required class="form-control" placeholder="comment here" />
</div>
<button type="submit" name="go" class="btn btn-primary">Add Comment</button>
</form>
</div><!-- end login-form -->
</div>
<!-- <div class="modal-footer">
<a href=""></a>
<button type="button" class="btn btn-default" data-dismiss="modal">Add Comment</button>
</div> -->
</div>
</div>
</div>
<ul class="list-inline social">
<li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-google-plus"></i></a></li>
<li><a href="#"><i class="fa fa-dribbble"></i></a></li>
<li><a href="#"><i class="fa fa-behance"></i></a></li>
<li><a href="#"><i class="fa fa-pinterest"></i></a></li>
</ul>
</div><!-- end price -->
</div><!-- end boxes -->
<div class="boxes boxs">
<div class="desiger-details text-center">
<img src="upload/member_05.jpg" class="img-circle" alt=""></a>
<h4><a href="public-profile.html"></a></h4>
<small><a href="/follow-user/"><i class="fa fa-user-plus">
@if((Auth::check()) && ($findFollow == true))
</i> Unfollow</a> </small>
@else
</i> Follow </a> </small>
@endif
</div><!-- end designer -->
</div><!-- end boxes -->
<div class="boxes boxs">
<div class="item-details">
<table>
<tr>
<td>Created on:</td>
<td></td>
</tr>
<tr>
<td>Category</td>
<td></td>
</tr>
<tr>
<td>Followers:</td>
<td></td>
</tr>
<tr>
<td>Likes:</td>
<td></td>
</tr>
<tr>
<td>Comments:</td>
<td></td>
</tr>
</table>
</div><!-- end item-details -->
</div><!-- end boxes -->
</div><!-- end sidebar -->
</div><!-- end row -->
</div><!-- end container -->
</section>
@endforeach
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-md-6 col-lg-5">
<div class="media cen-xs">
<p>
© Catalog INC. 2016 - All Rights Reserverd.<br>
Idea by <a class="madeby" href="http://showwp.com">Show WP</a> made with <i class="fa fa-heart"></i> coded with <i class="fa fa-html5"></i>
</p>
</div>
</div>
<div class="col-md-6 col-lg-7">
<ul class="list-inline text-right cen-xs">
<li><a href="#">Home</a></li>
<li><a href="#">Site Terms</a></li>
<li><a href="#">Copyrights</a></li>
<li><a href="#">License</a></li>
<li><a href="#">Legal</a></li>
<li><a class="topbutton" href="#">Back to top <i class="fa fa-angle-up"></i></a></li>
</ul>
</div>
</div><!-- end row -->
</div><!-- end container -->
</footer><!-- end footer -->
</div><!-- end wrapper -->
<!-- END SITE -->
<script src=""></script>
<script src=""></script>
<script src=""></script>
<!-- FlexSlider JavaScript
================================================== -->
<script src=""></script>
<script>
(function($) {
"use strict";
$(window).load(function() {
$('#carousel').flexslider({
animation: "slide",
controlNav: false,
directionNav: false,
animationLoop: true,
slideshow: true,
itemWidth: 92,
itemMargin: 0,
asNavFor: '#slider'
});
$('#slider').flexslider({
animation: "fade",
controlNav: false,
animationLoop: false,
slideshow: true,
sync: "#carousel"
});
});
})(jQuery);
</script>
</body>
</html>`
Product Controller
public function showProductDescription($id) {
// echo $id;
$category = Category::all()->sortBy('category_name');
// $category->category_name;
$userLikes = new Comment();
$products = Product::where('id', $id)->get();
$comments = Comment::where('product_id', $id)->get();
$commentCount = Comment::where('product_id', $id)->get('comments')->count();
$pag = Comment::where('product_id', $id)->paginate(10);
if(Auth::check()) {
$carts = Cart::where('user_id', Auth::user()->id)
->where('active', '=', '1')->count();
$findFollow = Following::where('user_id', Auth::user()->id)
->where('followed_to', $id)->first();
$findLikes = Comment::where('user_id', Auth::user()->id)
->where('product_id', $id)->first();
// dd(Product::all());
// dd($findFollow);
// dd($findLikes);
// dd($pag);
// dd($commentCount);
// die();
return view('products.productView', compact('products', 'comments', 'pag', 'commentCount', 'carts', 'findFollow', 'category',
'userLikes', 'findLikes'));
} else {
$carts = Cart::where('active', '=', '1')->count();
$findFollow = '';
$findLikes = '';
// dd(Product::all());
// dd($findFollow);
// dd($findLikes);
// dd($pag);
// dd($commentCount);
// die();
return view('products.productView', compact('products', 'comments', 'pag', 'commentCount', 'carts', 'findFollow', 'category',
'userLikes', 'findLikes'));
}
}
public function likedProduct($id) {
if(Auth::check()) {
$product = Product::where('id', $id)->first();
$userLikes = new Comment();
$userLikes->user_id = Auth::user()->id;
$userLikes->product_id = $product->id;
$userLikes->likes = '1';
$userLikes->save();
if($product->total_likes == 0) {
$product->total_likes = 1;
} else {
$product->total_likes = $product->total_likes + 1;
}
$product->save();
return redirect()->action('ProductController@showProductDescription', ['id' => $id]);
} else {
Session::flash("message", "OOPS! You dont have permission to upload the items. Please register first.");
return redirect("/register-user");
}
}
public function unlikeProduct($id) {
if(Auth::check()) {
$comments = Comment::where('user_id', Auth::user()->id)
->where('product_id', $id)->delete();
$product = Product::where('id', $id)->get('total_likes')->count();
// echo $product;
// die();
if($product>0) {
$productLikes = Product::where('id', $id)->first();
$productLikes->total_likes = $productLikes->total_likes - 1;
$productLikes->save();
}
// Session::flash("message", "OOPS! You dont have permission to upload the items. Please register first.");
return redirect()->action('ProductController@showProductDescription', ['id' => $id]);
} else {
Session::flash("message", "OOPS! You dont have permission to upload the items. Please register first.");
return redirect("/register-user");
}
}
public function productComment($id) {
if(Auth::check()) {
$c = Input::get('comment');
$product = Product::where('id', $id)->first();
$user_comments = new Comment();
$user_comments->user_id = Auth::user()->id;
$user_comments->product_id = $product->id;
$user_comments->comments = $c;
$user_comments->save();
if($product->total_comments == 0) {
$product->total_comments = 1;
} else {
$product->total_comments = $product->total_comments + 1;
}
$product->save();
Session::flash('message', 'Your comment has been added successfully');
return redirect()->action('ProductController@showProductDescription', ['id' => $id]);
} else {
Session::flash("message", "OOPS! You dont have permission to upload the items. Please register first.");
return redirect("/register-user");
}
}
I have updated the code so if you can help identifying the problem as I failed to identify the problem for the last one and half day and I need to get this fixed
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire