public function addcustomerfirst($name, $last_name, $cin, $mail, $adress, $function, $phone, $car) { $customer = new Customer(); $customer->name = $name; $customer->last_name = $last_name; $customer->cin = $cin; $customer->mail = $mail; $customer->adress = $adress; $customer->function = $function; $customer->phone = $phone; $customer->car = $car; $customer->commercial_id = Controller::User()->id; $customer->save(); return $customer; }
public function showHours($date, $car) { $row = TestDriveDay::IdDate($date, $car)->get(); //dd($row); $id = $row[0]->id; $hours = TestDriveHour::ListHeureIndispo($id)->get(); //dd($hours); $in = array(); foreach ($hours as $hour) { $cust = Customer::find($hour->customer_id); $in['h'] = $hour->hour; if ($hour->customer_id == 1) { $in['state'] = 'false'; $in['annuler'] = 'false'; } else { $in['state'] = 'true'; if ($cust->commercial_id == Controller::User()->id) { $in['annuler'] = 'true'; $in['attach_id'] = $cust->id; $in['attach_name'] = $cust->name; $in['line'] = 'Pour'; $in['id_hour'] = $hour->id; } else { $in['annuler'] = 'false'; $in['attach_id'] = $cust->commercial_id; $in['attach_name'] = User::find($cust->commercial_id)->name; $in['line'] = 'Par'; } } $in['id'] = $id; $re[$hour->id] = $in; } $re = json_encode($re); return $re; }
public function storeOffline(Request $request) { //--ADD NEW CUSTOMER // $user::Auth // dd($request); $cust = json_decode($request->hidden_customer, false); $testCin = Customer::GetCinCustomer($cust->cin)->get(); if (!isset($testCin[0])) { $customer = new Customer(); $customer->name = $cust->name; $customer->last_name = $cust->last_name; $customer->cin = $cust->cin; $customer->mail = $cust->mail; $customer->adress = $cust->adress; $customer->function = $cust->function; $customer->phone = $cust->phone; $customer->car = $cust->car; $customer->commercial_id = Controller::User()->id; $customer->save(); //Customer::firstOrCreate(['cin' => $cust->cin]); //$newCustomer = // attacher client au commercial courant //$newCustomer->attachUser($user); return 'true'; } else { return 'false'; } }
public function parametres() { $title = 'Paraétres généraux du compte'; $nom_prenom = Controller::User()->name; $email = Controller::User()->email; $phone = Controller::User()->phone; return view('Users.parametres', ['title' => $title, 'nom_prenom' => $nom_prenom, 'email' => $email, 'phone' => $phone]); }