CRM - tp 1,2, et 3 bientot fini
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
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'
|
||||
]
|
||||
];
|
||||
|
||||
return view('clients', ['clients' => $clients]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$email = 'contact@mini-crm.test';
|
||||
$phone = '01 23 45 67 89';
|
||||
|
||||
return view('contacts.index', ['email' => $email, 'phone' => $phone]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
abstract class Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// ici tu mettras ton tableau $clients
|
||||
|
||||
// puis tu retourneras la vue clients
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index(){
|
||||
|
||||
$stock = '0';
|
||||
$company = 'OTS';
|
||||
$clients = '0';
|
||||
// $clients = ['Jean Dupont', 'Didier Barcola', 'Paul Mbappé', 'Désiré Neves', 'Achraf Mendes'];
|
||||
// $products = '48';
|
||||
|
||||
|
||||
$orders = '83';
|
||||
$name = 'SUR LA MARCHE';
|
||||
$city = 'Courbevois';
|
||||
$products = [
|
||||
'Ordinateur',
|
||||
'Écran',
|
||||
'Clavier',
|
||||
'Souris',
|
||||
'Webcam'
|
||||
];
|
||||
return view('home', [
|
||||
'company' => $company, 'clients' => $clients, 'products' => $products, 'orders' => $orders, 'name' => $name, 'city' => $city, 'company' => $company, 'stock' => $stock]);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
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]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
#[Fillable(['name', 'email', 'password'])]
|
||||
#[Hidden(['password', 'remember_token'])]
|
||||
class User extends Authenticatable
|
||||
{
|
||||
/** @use HasFactory<UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user