inscription setup
This commit is contained in:
parent
9d84ae1692
commit
9ecb97bbfa
17 changed files with 1057 additions and 8 deletions
339
app/Http/Controllers/CustomerController.php
Normal file
339
app/Http/Controllers/CustomerController.php
Normal file
|
|
@ -0,0 +1,339 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\CustomerRegisterRequest;
|
||||
use App\Mail\PasswordResetMail;
|
||||
use App\Mail\RegisterConfirmMail;
|
||||
use App\Models\Customers;
|
||||
use App\Models\PasswordReset;
|
||||
use App\Models\Products;
|
||||
use App\Models\Recipes;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class CustomerController extends Controller
|
||||
{
|
||||
/**
|
||||
* Affiche la page d'inscription
|
||||
*/
|
||||
public function registerForm()
|
||||
{
|
||||
if (Auth::guard('customer')->check()) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
return view('auth.register');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enregistre le customer dans la base de données
|
||||
*/
|
||||
public function register(CustomerRegisterRequest $request)
|
||||
{
|
||||
/** @var \App\Lib\LDCCRM\ApiV1 */
|
||||
$crm = app('crmApi');
|
||||
$crmCustomer = $crm->createCustomer(
|
||||
$request->email,
|
||||
$request->password,
|
||||
$request->firstname,
|
||||
$request->lastname,
|
||||
$request->optin !== null ? 1 : 0,
|
||||
$birthDate = Carbon::createFromDate(
|
||||
$request->year,
|
||||
$request->month,
|
||||
$request->day
|
||||
)->format('Y-m-d'),
|
||||
isset($phone) ? $phone : null,
|
||||
isset($address) ? $address : null,
|
||||
null,
|
||||
$request->city,
|
||||
$request->postcode,
|
||||
null
|
||||
);
|
||||
|
||||
if ($crmCustomer->status === "OK") {
|
||||
$customer = new Customers($request->all());
|
||||
$customer->crm_id = $crmCustomer->user->crm_id;
|
||||
$customer->hashcode = $crmCustomer->user->hashcode;
|
||||
$customer->save();
|
||||
|
||||
Mail::to($request->email)->send(new RegisterConfirmMail($customer, $request->firstname));
|
||||
|
||||
return view('front.auth.confirm-register');
|
||||
} else {
|
||||
switch ($crmCustomer->code) {
|
||||
case 102:
|
||||
return back()->withInput()->withErrors(
|
||||
"Les champs obligatoires n'ont pas été correctement remplis."
|
||||
);
|
||||
case 103:
|
||||
return back()->withInput()->withErrors(
|
||||
"Un compte est déjà associé à cette adresse email."
|
||||
);
|
||||
default:
|
||||
return back()->withInput()->withErrors(
|
||||
"Une erreur est survenue lors de l'inscription, merci de réessayer plus tard."
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne la page de connexion
|
||||
*/
|
||||
public function authenticateForm(Request $request)
|
||||
{
|
||||
if (Auth::guard('customer')->check()) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
if ($request->get('url')) {
|
||||
Session::put('url.intended', $request->get('url'));
|
||||
Session::save();
|
||||
}
|
||||
return view('front.auth.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gère l'authentification des customers
|
||||
*/
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => 'required|email:rfc',
|
||||
'password' => 'required',
|
||||
]);
|
||||
|
||||
$email = filter_var($request->email, FILTER_SANITIZE_EMAIL);
|
||||
$password = $request->password;
|
||||
$remember = $request->remember !== null ? true : false;
|
||||
|
||||
/** @var Customers */
|
||||
$customer = Customers::where('email', $email)->first();
|
||||
if ($customer) {
|
||||
/** @var \App\Lib\LDCCRM\ApiV1 */
|
||||
$crm = app('crmApi');
|
||||
$result = $crm->loginCustomer($email, $password);
|
||||
if ($result->status === "OK") {
|
||||
/** @var \Illuminate\Auth\SessionGuard */
|
||||
$guard = Auth::guard('customer');
|
||||
$guard->login($customer, $remember);
|
||||
$url = Session::pull('url.intended');
|
||||
Session::forget('url.intended');
|
||||
Session::save();
|
||||
return redirect()->to($url);
|
||||
} else {
|
||||
switch ($result->code) {
|
||||
case 115:
|
||||
return back()->withErrors("Veuillez vérifier que vous avez correctement rempli les champs obligatoires.");
|
||||
case 116:
|
||||
Mail::to($email)->send(new RegisterConfirmMail($customer, null));
|
||||
return back()->withErrors("Votre compte n'est pas activé, vérifier dans vos emails pour y trouver le mail de confirmation. Un lien d'activation vous a été renvoyer.");
|
||||
case 117 || 118 || 119:
|
||||
return back()->withErrors("Email ou mot de passe incorrect.");
|
||||
default:
|
||||
return back()->withErrors("Une erreur est survenue, merci de réessayer ultérieurement.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return back()->withErrors("Email ou mot de passe incorrect.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Active le compte d'un customer
|
||||
*/
|
||||
public function activate($hashcode)
|
||||
{
|
||||
$hashcode = filter_var($hashcode, FILTER_SANITIZE_STRING);
|
||||
$customer = Customers::select('crm_id')->where('hashcode', $hashcode)->first();
|
||||
if ($customer) {
|
||||
/** @var \App\Lib\LDCCRM\ApiV1 */
|
||||
$crm = app('crmApi');
|
||||
$result = $crm->activateCustomer($customer->crm_id);
|
||||
if ($result->status === "OK") {
|
||||
return view('front.auth.activate')->with('message', 'Votre compte a bien été activé, vous pouvez désormais vous connecter.');
|
||||
} else {
|
||||
return view('front.auth.activate')->with('message', "Ce lien d'activation n'est pas valide.");
|
||||
}
|
||||
} else {
|
||||
return view('front.auth.activate')->with('message', "Ce lien d'activation n'est pas valide.");
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
if (Auth::guard('customer')->check()) {
|
||||
Auth::guard('customer')->logout();
|
||||
return redirect()->route('home');
|
||||
}
|
||||
}
|
||||
|
||||
public function passwordReset(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'email' => 'required|email:rfc|max:255',
|
||||
]);
|
||||
|
||||
$email = filter_var($request->email, FILTER_SANITIZE_EMAIL);
|
||||
|
||||
$customerExist = Customers::where('email', $email)->count() === 0 ? false : true;
|
||||
|
||||
if ($customerExist) {
|
||||
// Suppression des anciens tokens
|
||||
PasswordReset::where('email', $email)->delete();
|
||||
|
||||
$token = Str::random(80);
|
||||
|
||||
$passwordReset = new PasswordReset();
|
||||
$passwordReset->email = $email;
|
||||
$passwordReset->token = $token;
|
||||
$passwordReset->created_at = now();
|
||||
$passwordReset->save();
|
||||
|
||||
Mail::to($email)->send(new PasswordResetMail($token));
|
||||
return back()->with('success', __("La procédure pour changer votre mot de passe a été envoyé sur votre email."));
|
||||
} else {
|
||||
return back()->withErrors(__("Cette adresse email n'est pas enregistrée dans nos services."));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the view used to change the password of a user when he required it
|
||||
* @param $token Token used to identificate the user to change the password of
|
||||
* @return View The view to print
|
||||
*/
|
||||
public function viewChangePassword($token)
|
||||
{
|
||||
$pwdReset = PasswordReset::where('token', $token)->first();
|
||||
if (!$pwdReset) {
|
||||
abort(419);
|
||||
}
|
||||
$customer = Customers::where('email', $pwdReset->email)->first();
|
||||
if (!$customer) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return view('front.auth.password-reset', compact('customer'))->with('token', $token);
|
||||
}
|
||||
|
||||
public function changePassword(Request $request, $token)
|
||||
{
|
||||
$request->validate([
|
||||
'password' => 'required|confirmed|min:8|max:255'
|
||||
]);
|
||||
|
||||
$password = $request->password;
|
||||
|
||||
try {
|
||||
$passwordReset = PasswordReset::where('token', $token)->first();
|
||||
$customer = Customers::where('email', $passwordReset->email)->first();
|
||||
$crmId = $customer->crm_id;
|
||||
} catch (Exception $e) {
|
||||
return back()->withErrors("Changement du mot de passe impossible, les données envoyés sont incorrectes.");
|
||||
}
|
||||
/** @var \App\Lib\LDCCRM\ApiV1 */
|
||||
$crm = app('crmApi');
|
||||
$result = $crm->changePwdCustomer($crmId, $password);
|
||||
if ($result->status === "OK") {
|
||||
$passwordReset->delete();
|
||||
return view('front.auth.password-reset-ok', compact('customer'));
|
||||
} else {
|
||||
switch ($result->code) {
|
||||
case 107:
|
||||
return back()->withErrors("Veuillez vérifier que vous avez correctement rempli les champs obligatoires.");
|
||||
case 108 || 109:
|
||||
return back()->withErrors("Changement impossible, compte inexistant.");
|
||||
default:
|
||||
return back()->withErrors("Une erreur est survenue, merci de réessayer ultérieurement.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function changePasswordWhenAuthenticated(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'password' => 'required|min:8|confirmed|max:255'
|
||||
]);
|
||||
|
||||
$crm = app('crmApi');
|
||||
$customer = $crm->changePwdCustomer(Auth::guard('customer')->user()->crm_id, $request->password);
|
||||
|
||||
if ($customer->status === "OK") {
|
||||
return back()->with('success', __("Modifications enregistrés !"));
|
||||
} else {
|
||||
return back()->withErrors(__("Une erreur est survenue, merci de réessayer ultérieurement."));
|
||||
}
|
||||
}
|
||||
|
||||
public function changeOptin($token)
|
||||
{
|
||||
// TODO : Route et test de la méthode avec nouveau client CRM pour l'opt in
|
||||
die("Attente");
|
||||
$crmId = Customers::where('hashcode', $token)->first()->crm_id;
|
||||
|
||||
/** @var \App\Lib\LDCCRM\ApiV1 */
|
||||
$crm = app('crmApi');
|
||||
$result = $crm->toggleOptInCustomer($crmId);
|
||||
if ($result->status === "OK") {
|
||||
dd("OK");
|
||||
return back()->with('success', 'Modification enregistrée !');
|
||||
} else {
|
||||
switch ($result->code) {
|
||||
case 113 || 114:
|
||||
dd("KO 113 ou 114");
|
||||
return back()->withErrors("Mise à jour impossible, compte inexistant.");
|
||||
default:
|
||||
dd("KO default");
|
||||
return back()->withErrors("Une erreur est survenue, merci de réessayer ultérieurement.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setFavoriteRecipe(Recipes $recipe, bool $status)
|
||||
{
|
||||
/** @var Customer */
|
||||
$customer = Auth::guard('customer')->user();
|
||||
if ($status) {
|
||||
$customer->recipes()->attach($recipe);
|
||||
} else {
|
||||
$customer->recipes()->detach($recipe);
|
||||
}
|
||||
return response()->json();
|
||||
}
|
||||
|
||||
public function setItemInCart(Products $product, bool $status)
|
||||
{
|
||||
/** @var \App\Models\Customer */
|
||||
$customer = Auth::guard('customer')->user();
|
||||
if ($status) {
|
||||
$customer->products()->attach($product);
|
||||
} else {
|
||||
$customer->products()->detach($product);
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
// TODO : Implémenter la suppression lorsque la CRM sera prête pour le faire aussi
|
||||
die('Not implemented yet');
|
||||
// Suppression d'un compte client
|
||||
$customer = Customers::findOrFail($id);
|
||||
$customer->recipes()->delete();
|
||||
$customer->products()->delete();
|
||||
$customer->answers()->delete();
|
||||
$customer->forums()->delete();
|
||||
|
||||
// TODO : Suppression via la CRM
|
||||
|
||||
if (Auth::guard('customer')->user()->id === $customer->id)
|
||||
Auth::guard('customer')->logout();
|
||||
$customer->delete();
|
||||
|
||||
return redirect()->route('home');
|
||||
}
|
||||
}
|
||||
56
app/Http/Requests/CustomerRegisterRequest.php
Normal file
56
app/Http/Requests/CustomerRegisterRequest.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CustomerRegisterRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'required|email:rfc,dns,spoof|max:255',
|
||||
'username' => 'required|string|max:255|unique:customers,username',
|
||||
'firstname' => 'required|string|max:255',
|
||||
'lastname' => 'required|string|max:255',
|
||||
'day' => 'required|alpha_num|gt:0|lt:32',
|
||||
'month' => 'required|alpha_num|gt:0|lt:13',
|
||||
'year' => [
|
||||
'required', 'alpha_num', 'gt:' . (date('Y') - 101), 'lt:' . (date('Y') + 1),
|
||||
function ($attribute, $value, $fail) {
|
||||
$birthDate = Carbon::createFromDate($this->year, $this->month, $this->day);
|
||||
// @phpcs:ignore PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace
|
||||
if (
|
||||
$birthDate->format('dmY') !== $this->day . $this->month . $this->year ||
|
||||
$birthDate > Carbon::now()
|
||||
) {
|
||||
$fail(__('Veuillez entrer une date de naissance valide'));
|
||||
}
|
||||
}
|
||||
],
|
||||
'address' => 'sometimes|max:255',
|
||||
'phone' => 'sometimes|max:255',
|
||||
'city' => 'required|string|max:255',
|
||||
'postcode' => 'required',
|
||||
'password' => 'required|confirmed|min:8|max:255',
|
||||
'password' => 'required|confirmed|min:8|max:255',
|
||||
'optin' => 'sometimes',
|
||||
];
|
||||
}
|
||||
}
|
||||
189
app/Lib/LDCCRM/ApiV1.php
Normal file
189
app/Lib/LDCCRM/ApiV1.php
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib\LDCCRM;
|
||||
|
||||
class ApiV1
|
||||
{
|
||||
private $endpoint;
|
||||
private $api_key;
|
||||
|
||||
public function __construct($endpoint, $api_key)
|
||||
{
|
||||
$this->endpoint = $endpoint;
|
||||
$this->api_key = $api_key;
|
||||
}
|
||||
|
||||
public function getCustomer($id)
|
||||
{
|
||||
return $this->callAPI('GET', "/customer/id/$id");
|
||||
}
|
||||
|
||||
public function getCustomerByEmail($email)
|
||||
{
|
||||
return $this->callAPI('GET', "/customer/email/$email");
|
||||
}
|
||||
|
||||
public function createCustomer($email, $password, $firstname, $lastname, $optin, $birthdate = null, $phone = null, $address = null, $address2 = null, $city = null, $postcode = null, $country = null)
|
||||
{
|
||||
$user = [
|
||||
'email' => $email,
|
||||
'password' => $password,
|
||||
'firstname' => $firstname,
|
||||
'lastname' => $lastname,
|
||||
'opt_in' => $optin,
|
||||
'birth_date' => $birthdate,
|
||||
'phone' => $phone,
|
||||
'address' => $address,
|
||||
'address2' => $address2,
|
||||
'city' => $city,
|
||||
'postcode' => $postcode,
|
||||
'country' => $country
|
||||
];
|
||||
return $this->callAPI('POST', '/customer/create', $user);
|
||||
}
|
||||
|
||||
public function updateCustomer($crmId, $firstname = null, $lastname = null, $optin = null, $birthdate = null, $phone = null, $address = null, $address2 = null, $city = null, $postcode = null, $country = null)
|
||||
{
|
||||
$user = [];
|
||||
|
||||
if ($firstname !== null) {
|
||||
$user['firstname'] = $firstname;
|
||||
}
|
||||
|
||||
if ($lastname !== null) {
|
||||
$user['lastname'] = $lastname;
|
||||
}
|
||||
|
||||
if ($optin !== null) {
|
||||
$user['opt_in'] = $optin;
|
||||
}
|
||||
|
||||
if ($birthdate !== null) {
|
||||
$user['birth_date'] = $birthdate;
|
||||
}
|
||||
|
||||
if ($phone !== null) {
|
||||
$user['phone'] = $phone;
|
||||
}
|
||||
|
||||
if ($address !== null) {
|
||||
$user['address'] = $address;
|
||||
}
|
||||
|
||||
if ($address2 !== null) {
|
||||
$user['address2'] = $address2;
|
||||
}
|
||||
|
||||
if ($city !== null) {
|
||||
$user['city'] = $city;
|
||||
}
|
||||
|
||||
if ($postcode !== null) {
|
||||
$user['postcode'] = $postcode;
|
||||
}
|
||||
|
||||
if ($country !== null) {
|
||||
$user['country'] = $country;
|
||||
}
|
||||
|
||||
|
||||
return $this->callAPI('PUT', "/customer/$crmId", $user);
|
||||
}
|
||||
|
||||
public function deleteCustomer($id)
|
||||
{
|
||||
return $this->callAPI('DELETE', "/customer/$id");
|
||||
}
|
||||
|
||||
public function changePwdCustomer($id, $password)
|
||||
{
|
||||
return $this->callAPI('POST', "/customer/$id/change-password", ['password' => $password]);
|
||||
}
|
||||
|
||||
public function activateCustomer($id)
|
||||
{
|
||||
return $this->callAPI('POST', "/customer/$id/activate");
|
||||
}
|
||||
|
||||
public function toggleOptInCustomer($id)
|
||||
{
|
||||
return $this->callAPI('POST', "/customer/$id/toggle-optin");
|
||||
}
|
||||
|
||||
public function loginCustomer($email, $password)
|
||||
{
|
||||
return $this->callAPI('POST', "/customer/login", ['email' => $email, 'password' => $password]);
|
||||
}
|
||||
|
||||
public function createSingleOptin($email)
|
||||
{
|
||||
return $this->callAPI('POST', '/single-optin', ['email' => $email]);
|
||||
}
|
||||
|
||||
public function ArcadiaOutgoingMail($crm_id, $fields, $type)
|
||||
{
|
||||
return $this->callAPI('POST', '/arcadia/outgoing-mail', ['crm_id' => $crm_id, 'fields' => json_encode($fields), 'type' => $type]);
|
||||
}
|
||||
|
||||
private function callAPI($method, $url, $data = false)
|
||||
{
|
||||
|
||||
if (strpos($this->endpoint, "dev")) {
|
||||
if ($data !== false) {
|
||||
$data = array_merge($data, ['api_token' => $this->api_key]);
|
||||
} else {
|
||||
$data = ['api_token' => $this->api_key];
|
||||
}
|
||||
}
|
||||
|
||||
$url = $this->endpoint . '/api/v1' . $url;
|
||||
$curl = curl_init();
|
||||
switch ($method) {
|
||||
case "POST":
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
if ($data) {
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
}
|
||||
break;
|
||||
case "PUT":
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||
if ($data) {
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
|
||||
}
|
||||
break;
|
||||
case "DELETE":
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||
if ($data) {
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($data) {
|
||||
$url = sprintf("%s?%s", $url, http_build_query($data));
|
||||
}
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
if (!strpos($this->endpoint, "dev")) {
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Bearer ' . $this->api_key
|
||||
));
|
||||
}
|
||||
|
||||
$result = curl_exec($curl);
|
||||
|
||||
if (!curl_errno($curl)) {
|
||||
$http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
if (!in_array($http_code, [200, 201])) {
|
||||
return (object) ['status' => 'KO', 'code' => 500, 'message' => 'Connection to API failed - Code HTTP : ' . $http_code];
|
||||
}
|
||||
} else {
|
||||
return (object) ['status' => 'KO', 'code' => 500, 'message' => 'Connection to API failed : ' . curl_error($curl)];
|
||||
}
|
||||
|
||||
curl_close($curl);
|
||||
return json_decode($result);
|
||||
}
|
||||
}
|
||||
38
app/Mail/PasswordResetMail.php
Normal file
38
app/Mail/PasswordResetMail.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\Moments;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class PasswordResetMail extends Mailable implements ShouldQueue
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
private $token;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($token)
|
||||
{
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$token = $this->token;
|
||||
$moment = Moments::where('status', 1)->orderBy('updated_at', 'DESC')->first();
|
||||
return $this->subject("Réinitialiser votre accès au Club Le Gaulois")->view('front.mails.password-reset', compact('token', 'moment'));
|
||||
}
|
||||
}
|
||||
40
app/Mail/RegisterConfirmMail.php
Normal file
40
app/Mail/RegisterConfirmMail.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use App\Models\Moments;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class RegisterConfirmMail extends Mailable implements ShouldQueue
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
private $customer, $firstname;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($customer, $firstname)
|
||||
{
|
||||
$this->firstname = $firstname;
|
||||
$this->customer = $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$customer = $this->customer;
|
||||
$firstname = $this->firstname;
|
||||
$slugMoment = Moments::where('star_moment', 1)->first()->slug;
|
||||
return $this->subject("Confirmation d'inscription au Club Le Gaulois")->view('front.mails.register-ok', compact('customer', 'firstname', 'slugMoment'));
|
||||
}
|
||||
}
|
||||
97
app/Models/Customers.php
Normal file
97
app/Models/Customers.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Exceptions\CrmException;
|
||||
use App\Http\Resources\CustomerCrmResource;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Customers extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
|
||||
protected $fillable = [
|
||||
'email',
|
||||
'username'
|
||||
];
|
||||
|
||||
protected $guard = 'customer';
|
||||
|
||||
/**
|
||||
* Get the crm Data of a customer
|
||||
*
|
||||
* @throws CrmException
|
||||
* @return object crm user
|
||||
* @author Jérémy Munsch <jeremy.munsch@ldc.fr>
|
||||
*/
|
||||
public function getApiDataAttribute()
|
||||
{
|
||||
/** @var \App\Lib\LDCCRM\ApiV1 */
|
||||
$crm = app('crmApi');
|
||||
$response = (object)$crm->getCustomer($this->crm_id);
|
||||
switch ($response->status) {
|
||||
case 'KO':
|
||||
throw new CrmException(sprintf('Api call error %s', $response->message));
|
||||
case 'OK':
|
||||
return $response->user;
|
||||
default:
|
||||
throw new CrmException('Unknown status');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the crm Data of a customer
|
||||
*
|
||||
* @throws CrmException
|
||||
* @return object crm user
|
||||
* @author Jérémy Munsch <jeremy.munsch@ldc.fr>
|
||||
*/
|
||||
public function updateApiData(CustomerCrmResource $resource)
|
||||
{
|
||||
/** @var \App\Lib\LDCCRM\ApiV1 */
|
||||
$crm = app('crmApi');
|
||||
$response = (object) \call_user_func_array([$crm, 'updateCustomer'], $resource->toArray(null));
|
||||
switch ($response->status) {
|
||||
case 'KO':
|
||||
throw new CrmException(sprintf('Api call error %s', $response->message));
|
||||
case 'OK':
|
||||
return $response->user;
|
||||
default:
|
||||
throw new CrmException('Unknown status');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This mutate Customer attributes to array
|
||||
* including only non critical properties and crm values
|
||||
* (One that can be send to front office without security breach)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
if ($this->crm_id) {
|
||||
return collect(array_merge(
|
||||
parent::toArray(),
|
||||
(array)$this->apiData
|
||||
))->intersectByKeys([
|
||||
'email' => '',
|
||||
'firstname' => '',
|
||||
'lastname' => '',
|
||||
'address' => '',
|
||||
'address2' => '',
|
||||
'postcode' => '',
|
||||
'birth_date' => '',
|
||||
'city' => '',
|
||||
'country' => '',
|
||||
'opt_in' => '',
|
||||
'phone' => ''
|
||||
])->toArray();
|
||||
} else {
|
||||
return parent::toArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
app/Providers/CrmApiServiceProvider.php
Normal file
22
app/Providers/CrmApiServiceProvider.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Lib\LDCCRM\ApiV1;
|
||||
|
||||
class CrmApiServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
App::singleton('crmApi', function () {
|
||||
return new ApiV1(config('crm.CRM_ENDPOINT'), config('crm.CRM_API_TOKEN'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -185,6 +185,7 @@ return [
|
|||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\CrmApiServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ return [
|
|||
'provider' => 'users',
|
||||
'hash' => false,
|
||||
],
|
||||
|
||||
'customer' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'customers',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|
|
@ -71,6 +76,11 @@ return [
|
|||
'model' => App\Models\User::class,
|
||||
],
|
||||
|
||||
'customers' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\Models\Customers::class,
|
||||
]
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
|
|
|
|||
8
config/crm.php
Normal file
8
config/crm.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'CRM_ENDPOINT' => env('CRM_ENDPOINT'),
|
||||
'CRM_API_TOKEN' => env('CRM_API_TOKEN'),
|
||||
|
||||
];
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
// @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
|
||||
class CreateCustomersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->bigInteger('crm_id')->unsigned()->unique();
|
||||
|
||||
$table->string('email')->unique();
|
||||
$table->string('hashcode')->unique();
|
||||
$table->string('username')->unique();
|
||||
|
||||
$table->rememberToken();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('customers');
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,14 @@
|
|||
<input class="form__input" type="text" name="firstname" placeholder="Prénom*" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form__row">
|
||||
<div class="form__field">
|
||||
<label for="birth_date" class="form__input">Date de naissance *</label>
|
||||
</div>
|
||||
<div class="form__field">
|
||||
<input class="form__input" type="date" name="birth_date" placeholder="Date de naissance*" value="{{ old('birth_date') }}" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form__row">
|
||||
<div class="form__field">
|
||||
|
|
@ -50,17 +58,44 @@
|
|||
</div>
|
||||
<div class="form__row">
|
||||
<div class="form__field">
|
||||
<input class="form__input" type="date" name="date_of_birth" placeholder="Date de naissance*" required />
|
||||
<input class="form__input" type="password" name="password" placeholder="Mot de passe*" required />
|
||||
</div>
|
||||
<div class="form__field">
|
||||
<input class="form__input" type="password" name="password" placeholder="Mot de passe*" required />
|
||||
<input class="form__input" type="password" name="password_confirmation" placeholder="Confirmer votre mot de passe *" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form__row">
|
||||
<div class="form__field">
|
||||
<input class="form__input" type="tel" name="phone" id="phone" autocomplete="tel" placeholder="Téléphone" value="{{ old('phone') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form__row">
|
||||
<div class="form__field">
|
||||
<input class="form__input" name="address" type="text" placeholder="Adresse" value="{{ old('address') }}">
|
||||
</div>
|
||||
<div class="form__field">
|
||||
<input class="form__input" type="number" name="postal_code" id="postal_code" required autocomplete="postal-code" placeholder="Code postal *" value="{{ old('postal_code') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form__row">
|
||||
<div class="form__field">
|
||||
<input class="form__input" type="text" name="town" id="town" required autocomplete="address-level2" placeholder="Ville *" value="{{ old('town') }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form__field">
|
||||
<label class="custom-input custom-input_checkbox">
|
||||
<input type="checkbox" name="agree" />
|
||||
<span>J’ai lu et accepte les conditions générales et la politique de gestion des données personnelles.</span>
|
||||
<input type="checkbox" name="cgv" />
|
||||
<span>J’ai lu et accepte les <a href="{{ route('terms') }}" target="mentions">conditions générales</a> et la <a href="{{ route('privacy') }}" target="mentions">politique de gestion des données personnelles.</a></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form__field">
|
||||
<label class="custom-input custom-input_checkbox">
|
||||
<input id="checknews" type="checkbox" name="news" id="news">
|
||||
<span>Je souhaite m'inscrire à la newsletter {{ Config::get('theme.site_name') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form__field form__submit">
|
||||
|
|
|
|||
71
resources/views/front/canard/mails/password-reset.blade.php
Normal file
71
resources/views/front/canard/mails/password-reset.blade.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<table style="font-family: arial; font-size: 16px;" width="600" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
|
||||
<tbody>
|
||||
<tr style="background-color: #0f437e;">
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('club.index') }}" style="color:white; text-decoration:none;" rel="noopener">
|
||||
<img width="215" height="35" style="border:none; margin:0; display:block;" alt="Le Gaulois" src="{{ asset('assets/images/mail/header-1.jpg') }}">
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('products.index') }}" style="color:white; text-decoration:none;" rel="noopener">
|
||||
<img width="105" height="35" style="border:none; margin:0; display:block;" alt="Les produits" src="{{ asset('assets/images/mail/header-2.jpg') }}">
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('kitchen-side.index') }}" style="color:white; text-decoration:none;" rel="noopener">
|
||||
<img width="90" height="35" style="border:none; margin:0; display:block;" alt="Côté cuisine" src="{{ asset('assets/images/mail/header-3.jpg') }}">
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('brand.index') }}" style="color:white; text-decoration:none;" rel="noopener">
|
||||
<img width="80" height="35" style="border:none; margin:0; display:block;" alt="La marque" src="{{ asset('assets/images/mail/header-4.jpg') }}">
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('moment', $moment->slug) }}" style="color:white; text-decoration:none;" rel="noopener">
|
||||
<img width="110" height="35" style="border:none; margin:0; display:block;" alt="En ce moment" src="{{ asset('assets/images/mail/header-5.jpg') }}">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="background-color: #0f437e;">
|
||||
<td valign="top" style="border:none; margin:0; text-align:center;" colspan="5">
|
||||
<a target="_blank" href="{{ route('club.index') }}" style="color:white; text-decoration:none;" rel="noopener">
|
||||
<img width="600" height="205" style="border:none; margin:0; display:block;" alt="Le Club Le Gaulois" src="{{ asset('assets/images/mail/header-club.jpg') }}">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="border:none; margin:0; text-align:center; color:#e10f21; font-size:20px;" colspan="5">
|
||||
<img width="600" height="100" style="border:none; margin:0; display:block; " alt="MOT DE PASSE" src="{{ asset('assets/images/mail/title-mdp.jpg') }}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="border:none; margin:0; text-align:center;" colspan="5">
|
||||
<p>Bonjour,</p>
|
||||
<p>Pour changer votre mot de passe, cliquez sur le lien suivant :</p>
|
||||
<p style="font-size:18px; font-weight:bold;"><a href="{{ route('form-change-mdp', $token) }}" target="_blank" rel="noopener">Cliquez ici</a></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="border:none; margin:0; text-align:right;" colspan="5">
|
||||
<p style="margin-right:20px;">Gauloisement vôtre,<br>L’équipe Le Gaulois</p>
|
||||
<img width="600" height="20" style="border:none; margin:0; display:block;" alt="" src="{{ asset('assets/images/mail/spacer.gif') }}">
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="background-color: #0f437e;">
|
||||
<td valign="top" style="border:none; margin:0;"></td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('club.index') }}" style="color:white; text-decoration:none;" rel="noopener">
|
||||
<img width="105" height="78" style="border:none; margin:0; display:block;" alt="Le Club Le Gaulois" src="{{ asset('assets/images/mail/footer-logo.jpg') }}">
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="https://www.facebook.com/LeGauloisFrance/" style="color:white; text-decoration:none;" rel="noopener">
|
||||
<img width="90" height="78" style="border:none; margin:0; display:block;" alt="Facebook" src="{{ asset('assets/images/mail/footer-fb.jpg') }}">
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;"></td>
|
||||
<td valign="top" style="border:none; margin:0;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
87
resources/views/front/canard/mails/register-ok.blade.php
Normal file
87
resources/views/front/canard/mails/register-ok.blade.php
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Inscription au Club Le Gaulois</title>
|
||||
</head>
|
||||
<body>
|
||||
<table style="font-family: arial; font-size: 16px;" width="600" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
|
||||
<tr style="background-color: #0f437e;">
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('club.index') }}" style="color:white; text-decoration:none;">
|
||||
<img src="{{ asset('assets/images/mail/header-1.jpg') }}" width="215" height="35" style="border:none; margin:0; display:block;" alt="Le Gaulois"/>
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('products.index') }}" style="color:white; text-decoration:none;">
|
||||
<img src="{{ asset('assets/images/mail/header-2.jpg') }}" width="105" height="35" style="border:none; margin:0; display:block;" alt="Les produits"/>
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('kitchen-side.index') }}" style="color:white; text-decoration:none;">
|
||||
<img src="{{ asset('assets/images/mail/header-3.jpg') }}" width="90" height="35" style="border:none; margin:0; display:block;" alt="Côté cuisine"/>
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('brand.index') }}" style="color:white; text-decoration:none;">
|
||||
<img src="{{ asset('assets/images/mail/header-4.jpg') }}" width="80" height="35" style="border:none; margin:0; display:block;" alt="La marque"/>
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;">
|
||||
<a target="_blank" href="{{ route('moment', $slugMoment) }}" style="color:white; text-decoration:none;">
|
||||
<img src="{{ asset('assets/images/mail/header-5.jpg') }}" width="110" height="35" style="border:none; margin:0; display:block;" alt="En ce moment"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="background-color: #0f437e;">
|
||||
<td valign="top" style="border:none; margin:0; text-align:center;" colspan="5" >
|
||||
<a target="_blank" href="{{ route('club.index') }}" style="color:white; text-decoration:none;">
|
||||
<img src="{{ asset('assets/images/mail/header-club.jpg') }}" width="600" height="205" style="border:none; margin:0; display:block;" alt="Le Club Le Gaulois"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="border:none; margin:0; text-align:center; color:#e10f21; font-size:20px;" colspan="5">
|
||||
<img src="{{ asset('assets/images/mail/title-inscription.jpg') }}" width="600" height="89" style="border:none; margin:0; display:block; " alt="Inscription - Le Gaulois"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="border:none; margin:0; text-align:center;" colspan="5">
|
||||
<p>Bonjour{{ $firstname !== null ? " " . $firstname : null }},</p>
|
||||
<p>Vous venez de créer un compte sur <strong>le club des Gaulois</strong> : quelle bonne idée pour bénéficier du forum et de la Bourse aux échanges Départ’aimants et profitez des bons de réduction à imprimer !</p>
|
||||
<br>
|
||||
<p>Vous pouvez également enregistrer vos recettes favorites et les commenter et faire une liste de courses avec vos produits Le Gaulois préféré.</p>
|
||||
<br>
|
||||
<p>Pour confirmer votre inscription, rendez-vous à l'adresse suivante : <br><a href="{{ route('activer', $customer->hashcode) }}">{{ route('activer', $customer->hashcode) }}</a><br> ou cliquez sur le lien ci-dessous.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="border:none; margin:0; text-align:center; color:#e10f21; font-size:20px;" colspan="5">
|
||||
<a target="_blank" href="{{ route('activer', $customer->hashcode) }}" style="color:white; text-decoration:none;">
|
||||
<img src="{{ asset('assets/images/mail/btn-account.jpg') }}" width="600" height="72" style="border:none; margin:0; display:block; " alt="Activer mon compte - Le Gaulois"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" style="border:none; margin:0; text-align:right;" colspan="5">
|
||||
<p style="margin-right:20px;">Gauloisement vôtre,<br/>L’équipe Le Gaulois</p>
|
||||
<img src="{{ asset('assets/images/mail/spacer.gif') }}" width="600" height="20" style="border:none; margin:0; display:block;" alt=""/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="background-color: #0f437e;">
|
||||
<td valign="top" style="border:none; margin:0;" ></td>
|
||||
<td valign="top" style="border:none; margin:0;" >
|
||||
<a target="_blank" href="{{ route('club.index') }}" style="color:white; text-decoration:none;">
|
||||
<img src="{{ asset('assets/images/mail/footer-logo.jpg') }}" width="105" height="78" style="border:none; margin:0; display:block;" alt="Le Club Le Gaulois"/>
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;" >
|
||||
<a target="_blank" href="https://www.facebook.com/LeGauloisFrance/" style="color:white; text-decoration:none;">
|
||||
<img src="{{ asset('assets/images/mail/footer-fb.jpg') }}" width="90" height="78" style="border:none; margin:0; display:block;" alt="Facebook"/>
|
||||
</a>
|
||||
</td>
|
||||
<td valign="top" style="border:none; margin:0;" ></td>
|
||||
<td valign="top" style="border:none; margin:0;" ></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
@foreach ($products as $product)
|
||||
<div class="product-list__block">
|
||||
<div class="pl-item">
|
||||
<a class="pl-item__title title title_xs" href="{{route('product', ['productSlug' => $product->slug])}}">{{ $product->name }}</a>
|
||||
<a class="pl-item__title title title_xs" href="{{route('product', ['productSlug' => $product->slug])}}">{{ ucwords(strtolower($product->name)) }}</a>
|
||||
<a class="pl-item__image" href="{{route('product', ['productSlug' => $product->slug])}}"><img src="{{ asset('/images/produits/' . $product->picture )}}" /></a>
|
||||
<div class="pl-item__bottom">
|
||||
<div class="pl-item__price">{{ $product->formattedPrice }}/{{ $product->sell_unit }}</div>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<div class="flex-row__block">
|
||||
<div class="product__block">
|
||||
<div class="block-about">
|
||||
<h1 class="block-about__title block-about__title_desktop title">{{ $product->name }}</h1>
|
||||
<h1 class="block-about__title block-about__title_desktop title">{{ ucwords(strtolower($product->name)) }}</h1>
|
||||
<div class="block-about__description description">
|
||||
{!! $product->description !!}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route;
|
|||
use App\Http\Controllers\IndexController;
|
||||
use App\Http\Controllers\BasketController;
|
||||
use App\Http\Controllers\ProductsController;
|
||||
use App\Http\Controllers\CustomerController;
|
||||
// BO
|
||||
use App\Http\Controllers\Bo\DashboardController;
|
||||
use App\Http\Controllers\Bo\ContentController;
|
||||
|
|
@ -81,7 +82,21 @@ Route::namespace('Auth')
|
|||
Route::get('/se-connecter', [LoginController::class, 'index'])->name('login')->middleware('guest');
|
||||
Route::post('/login', [LoginController::class, 'login'])->name('login.post')->middleware('guest');
|
||||
Route::get('/se-deconnecter', [LoginController::class, 'logout'])->name('logout')->middleware('auth');
|
||||
Route::get('/inscription', [RegisterController::class, 'index'])->name('register')->middleware('guest');
|
||||
Route::post('/register', [RegisterController::class, 'register'])->name('register.post')->middleware('guest');
|
||||
//Route::get('/inscription', [RegisterController::class, 'index'])->name('register')->middleware('guest');
|
||||
//Route::post('/register', [RegisterController::class, 'register'])->name('register.post')->middleware('guest');
|
||||
Route::get('/inscription', [CustomerController::class, 'registerForm'])->name('register')->middleware('guest');
|
||||
Route::post('/register', [CustomerController::class, 'register'])->name('register.post')->middleware('guest');
|
||||
Route::get('/mot-de-passe-oublie', [ResetPasswordController::class, 'index'])->name('reset-password')->middleware('guest');
|
||||
});
|
||||
|
||||
/*
|
||||
Route::get('/inscription', 'CustomerController@registerForm')->name('form-inscription');
|
||||
Route::post('/inscription', 'CustomerController@register')->name('inscription');
|
||||
Route::get('/activer/{hashcode}', 'CustomerController@activate')->name('activer');
|
||||
Route::get('/connexion', 'CustomerController@authenticateForm')->name('form-connexion');
|
||||
Route::post('/connexion', 'CustomerController@authenticate')->name('connexion');
|
||||
Route::get('/deconnexion', 'CustomerController@logout')->name('deconnexion')->middleware('auth:customer');
|
||||
Route::post('/reinitialiser-mdp', 'CustomerController@passwordReset')->name('reinit-mdp');
|
||||
Route::get('/reinitialiser-mdp/{token}', 'CustomerController@viewChangePassword')->name('form-change-mdp');
|
||||
Route::post('/reinitialiser-mdp/{token}', 'CustomerController@changePassword')->name('change-mdp');
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue