49 lines
1.0 KiB
PHP
49 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
class ProductController extends Controller
|
|
{
|
|
public function index(){
|
|
|
|
$products = Product::all();
|
|
return view('product.index', [
|
|
'product' => $products
|
|
]);
|
|
|
|
// $products = [
|
|
// [
|
|
// 'name' => 'Ordinateur portable',
|
|
// 'price' => 899,
|
|
// 'stock' => 12
|
|
// ],
|
|
// [
|
|
// 'name' => 'Écran',
|
|
// 'price' => 249,
|
|
// 'stock' => 7
|
|
// ],
|
|
// [
|
|
// 'name' => 'Clavier',
|
|
// 'price' => 79,
|
|
// 'stock' => 25
|
|
// ],
|
|
// [
|
|
// 'name' => 'Souris',
|
|
// 'price' => 39,
|
|
// 'stock' => 42
|
|
// ],
|
|
// [
|
|
// 'name' => 'Webcam',
|
|
// 'price' => 99,
|
|
// 'stock' => 4
|
|
// ]
|
|
// ];
|
|
|
|
// return view('products.index', ['products' => $products]);
|
|
|
|
// }
|
|
|
|
}
|
|
} |