CRM - tp 1,2, et 3 bientot fini refresh
This commit is contained in:
@@ -1,29 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Client;
|
||||
class ClientsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$clients = [
|
||||
[
|
||||
'name' => 'Jean Dupont',
|
||||
'email' => 'jean@example.com',
|
||||
'city' => 'Paris'
|
||||
],
|
||||
[
|
||||
'name' => 'Marie Martin',
|
||||
'email' => 'marie@example.com',
|
||||
'city' => 'Lyon'
|
||||
],
|
||||
[
|
||||
'name' => 'Paul Durand',
|
||||
'email' => 'paul@example.com',
|
||||
'city' => 'Marseille'
|
||||
]
|
||||
];
|
||||
{
|
||||
// $clients = Client::all();
|
||||
|
||||
return view('clients', ['clients' => $clients]);
|
||||
// return view('clients.index', [
|
||||
// 'clients' => $clients
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// $clients = Client::where('city', 'Paris')->get();
|
||||
// $clients = Client::where('name', 'like', '%Martin%')->get();
|
||||
$clients = Client::find(1);
|
||||
return view('clients.index', [
|
||||
'clients' => $clients
|
||||
]);
|
||||
}
|
||||
|
||||
// $clients = [
|
||||
// [
|
||||
// 'name' => 'Jean Dupont',
|
||||
// 'email' => 'jean@example.com',
|
||||
// 'city' => 'Paris'
|
||||
// ],
|
||||
// [
|
||||
// 'name' => 'Marie Martin',
|
||||
// 'email' => 'marie@example.com',
|
||||
// 'city' => 'Lyon'
|
||||
// ],
|
||||
// [
|
||||
// 'name' => 'Paul Durand',
|
||||
// 'email' => 'paul@example.com',
|
||||
// 'city' => 'Marseille'
|
||||
// ]
|
||||
// ];
|
||||
|
||||
// return view('clients', ['clients' => $clients]);
|
||||
}
|
||||
}
|
||||
@@ -7,36 +7,43 @@ use Illuminate\Http\Request;
|
||||
class ProductController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
$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]);
|
||||
$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]);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user