i am try to get data from database to my index page. i complete code for get data. but dose note show anything in my index page.
i import that model.
This is my controller code
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Model\admin\Product;
class UserController extends Controller
{
function userIndex()
{
$products = Product::all();
return view('user/index', compact('products'));
}
function userContact()
{
return view('user.contact');
}
}
index file code
@foreach ($products as $product)
<li></li>
<li><div class="intro-item">
<figure>
<img src="" alt="#">
</figure>
<div class="product-info">
<h5></h5>
<p></p>
<a href="#" class="site-btn btn-line">ADD TO CART</a>
</div>
</div>
</li>
@endforeach
i do note get any error or data.
Aucun commentaire:
Enregistrer un commentaire