/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $input = $request->input();
     $data = $request->only('old_password', 'password', 'password_confirm');
     $rules = array('old_password' => 'required', 'password' => 'required', 'password_confirm' => 'required');
     $v = \Validator::make($data, $rules);
     if ($v->fails()) {
         return view('member.password_create')->withErrors($v)->withInput($data);
     } else {
         $old_password = $input['old_password'];
         //$old_password = Hash::make($old_password);
         if (Hash::check($old_password, Auth::user()->password)) {
             $password = $input['password'];
             $password = \Hash::make($password);
             $update = DB::table('members')->where('id', Auth::user()->id)->update(['password' => $password]);
             $history = new History();
             $history->action_id = Auth::user()->id;
             $history->action = 'Password Changed';
             $history->user = Auth::user()->name;
             $history->remark = '';
             $history->save();
             Session::flash('message', 'Password has been changed successfully');
             return Redirect::to('home');
         } else {
             Session::flash('message', 'Old password Incorrect');
             return view('member.password_create');
         }
     }
 }
Example #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param CreateHistoryRequest $request
  * @return Response
  */
 public function store(CreateHistoryRequest $request)
 {
     $history = new History();
     $history->fill($request->all());
     $history->user_id = Auth::id();
     $history->save();
     $application = Application::findOrFail($history->application->id);
     $application->status = $history->status;
     $application->save();
     $message = trans('messages.application_updated_successfully');
     Flash::info($message);
     return redirect()->route('admin.applications.show', $history->application);
 }
 public function userHistoric()
 {
     $user_id = Auth::user()->id;
     $customer_id = Customer::where('user_id', '=', $user_id)->value('id');
     $histories = History::where('customer_id', '=', $customer_id)->get();
     return view('front.user_historic', compact('histories'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param CreateApplicationRequest $request
  * @return Response
  */
 public function store(CreateApplicationRequest $request)
 {
     $application = new Application();
     $application->fill($request->all());
     $application->user_id = Auth::id();
     $application->status = 'process';
     $application->save();
     $history = new History();
     $history->status = $application->status;
     $history->message = trans('messages.application_sent_successfully');
     $history->user_id = $application->user_id;
     $history->application_id = $application->id;
     $history->save();
     $message = trans('messages.application_sent_successfully');
     Flash::info($message);
     return redirect()->route('applications.show', $application);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $practicalSkills = PracticalSkill::orderBy("order", "asc")->get(["name", "rank"]);
     $categories = Category::splitInHalf();
     $languages = Language::visible()->get();
     $records = History::visible()->get();
     $configs = Config::getConfigs(['currently-learning', 'resume']);
     return view('resume.index', compact('practicalSkills', 'categories', 'languages', 'records', 'configs'));
 }
Example #6
0
 public function history(Request $request)
 {
     $this->validate($request, ['id' => 'required', 'type' => 'required|in:1,-1']);
     $user = Auth::user();
     $id = $request->input('id');
     $value = $request->input('type');
     $history = History::find($id);
     $isLiked = $this->commit($user, $history, $id, $value);
     return ['hasCallback' => 1, 'callback' => 'history_liked', 'hasMsg' => 0, 'msg' => '', 'msgType' => '', 'returns' => ['num_like' => $history->num_like, 'num_dislike' => $history->num_dislike, 'is_liked' => $isLiked]];
 }
 /**
  * Bootstrap any application services.customers
  *
  * @return void
  */
 public function boot()
 {
     History::creating(function ($history) {
         $score = Score::find($history->product_id);
         if (!is_null($score)) {
             $score->score++;
             $score->number_command += $history->quantity;
             $score->save();
         } else {
             Score::create(['score' => 1, 'number_command' => $history->quantity]);
         }
     });
 }
 public function showHistory()
 {
     $histories = History::orderBy('command_at', 'cde_id', 'desc')->get();
     return view('admin.history', compact('histories'));
 }
 public function block($id)
 {
     $ret = Member::where('id', $id)->first();
     if ($ret->status == 1) {
         $update = \DB::table('members')->where('id', $id)->update(['status' => 0]);
         $history = new History();
         $history->action_id = $id;
         $history->action = 'Member Blocked';
         $history->user = Auth::user()->name;
         $history->remark = '';
         $history->save();
         Session::flash('blockmessage', 'Member has been blocked successfully');
     } else {
         $update = \DB::table('members')->where('id', $id)->update(['status' => 1]);
         $history = new History();
         $history->action_id = $id;
         $history->action = 'Member Unblocked';
         $history->user = Auth::user()->name;
         $history->remark = '';
         $history->save();
         Session::flash('unblockmessage', 'Member has been unblocked successfully');
     }
     Session::flash('memberid', $ret->type);
     return \Redirect::to('member/show');
 }
Example #10
0
 public function histories($id)
 {
     $episode = Episode::find($id, ['id', 'drama_id', 'title']);
     $drama = Drama::find($episode->drama_id, ['title']);
     $histories = History::with(['user' => function ($query) {
         $query->select('id', 'name');
     }])->select('user_id', 'type', 'content', 'created_at')->where('model', 1)->where('model_id', $id)->get();
     return view('episode.histories', ['episode' => $episode, 'drama' => $drama, 'histories' => $histories]);
 }
 public function savecde()
 {
     $id = Auth::user()->id;
     if (User::find($id)->customer) {
         $customer_id = User::find($id)->customer->id;
         $num_cde = History::orderBy('cde_id', 'desc')->first()->cde_id + 1;
         foreach (Session::get('cde') as $pdts) {
             foreach ($pdts as $pdt) {
                 $product = Product::find($pdt['id']);
                 $h = new History();
                 $h->product_id = $pdt['id'];
                 $h->customer_id = $customer_id;
                 $h->cde_id = $num_cde;
                 $h->price = $product->price;
                 $h->quantity = $pdt['quantity'];
                 $h->command_at = Carbon::now();
                 $h->status = 'finalized';
                 $h->save();
                 $product->quantity -= $pdt['quantity'];
                 $product->save();
             }
         }
         $customer = Customer::find($customer_id);
         $customer->number_command += 1;
         $customer->save();
         Session::forget('cde');
         return redirect('/')->with(['message' => 'Votre commande a bien été validée sous le N° ' . $num_cde, 'alert' => 'success']);
     } else {
         return redirect('/registerCustomer');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if ($id != 0) {
         $resumdel1 = PersonalInformation::where('id', $id)->delete();
         $resumdel2 = EducationalInformation::where('pid', $id)->delete();
         $resumdel3 = WorkInformation::where('pid', $id)->delete();
         $resumdel4 = Language::where('pid', $id)->delete();
         $resumdel5 = SkillsInformation::where('pid', $id)->delete();
         $resumdel = AdditionalInformation::where('pid', $id)->delete();
         $resumdel = UploadInformation::where('pid', $id)->delete();
         $resumdel = PrivacyInformation::where('pid', $id)->delete();
     } else {
         $deleteChecked = Input::get('resume');
         if ($deleteChecked) {
             foreach ($deleteChecked as $delete) {
                 $resumdel1 = PersonalInformation::where('id', $delete)->delete();
                 $resumdel2 = EducationalInformation::where('pid', $delete)->delete();
                 $resumdel3 = WorkInformation::where('pid', $delete)->delete();
                 $resumdel4 = Language::where('pid', $delete)->delete();
                 $resumdel5 = SkillsInformation::where('pid', $delete)->delete();
                 $resumdel = AdditionalInformation::where('pid', $delete)->delete();
                 $resumdel = UploadInformation::where('pid', $delete)->delete();
                 $resumdel = PrivacyInformation::where('pid', $delete)->delete();
             }
             Session::flash('message', 'Successfully deleted');
             $history = new History();
             $history->action_id = 0;
             $history->action = 'Resume deleted';
             $history->user = Auth::user()->name;
             $history->remark = 'Number of Resume deleted=' . count($deleteChecked);
             $history->save();
         } else {
             Session::flash('nrmessage', 'Resume are not Selected');
         }
     }
     return Redirect::to('resume');
 }
 public function productHistoric()
 {
     $histories = History::all();
     return view('admin.historic', compact('histories'));
 }
 public function order(Request $request)
 {
     $customer = Customer::where('email', '=', $request->email)->first();
     if (empty($customer)) {
         Session::flash('message', 'Désolé, cet email n\'apparait pas dans notre BDD.');
         return redirect()->back();
     }
     if (Hash::check($request->password, $customer->password)) {
         $history = new History();
         $history->customer_id = $customer->id;
         $history->total = $request->total;
         $history->save();
         Session::flush();
         Session::flash('message', 'Merci pour votre commande !');
         return redirect()->back();
     } else {
         Session::flash('message', 'Désolé, merci de vérifier votre mot de passe.');
         return redirect()->back();
     }
 }
 /**
  * Display the order histories
  */
 public function index()
 {
     $histories = History::with('product', 'customer')->orderBy('command_at', 'desc')->paginate(20);
     $title = "History";
     return view('admin.history', compact('histories', 'title'));
 }
 /**
  * Get the beer recommendations for a user.  Create a user's taste profile using the star rating system as a weight
  * and provide recommendations for beers that fall in a user's profile.
  *
  * @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response
  */
 public function recommend()
 {
     // get the history/past beers for a user
     $history = History::with('beer')->where('user_id', '=', $this->user->id)->get();
     // define the variables that serve as predictors
     $count = count($history);
     $starCount = 0;
     $srm = 0;
     $abv = 0;
     $ibu = 0;
     // ensure that the cellar has beers
     if ($count == 0) {
         return response(['status' => 'failed', 'message' => 'To get a recommendation the user\'s cellar must contain beers.']);
     }
     // add variable to its total weighted value
     foreach ($history as $rating) {
         $beer = $rating->beer;
         $starCount += $rating->rating;
         $srm += $beer->srm * $rating->rating;
         $abv += $beer->abv * $rating->rating;
         $ibu += $beer->ibu * $rating->rating;
     }
     // determine the mean weight values
     $srm /= $starCount;
     $abv /= $starCount;
     $ibu /= $starCount;
     // exclude beers that are already in a users cellar
     $usersBeers = $this->user->history()->pluck('beer_id');
     // retrieve beers that fall within a certain range of the means
     $beers = Beer::where('srm', '>=', $srm - 1.5)->where('srm', '<=', $srm + 1.5)->where('ibu', '>=', $ibu - 15)->where('ibu', '<=', $ibu + 15)->where('abv', '>=', $abv - 0.75)->where('abv', '<=', $abv + 0.75)->with('style', 'brewery')->whereNotIn('id', $usersBeers)->get();
     return response(['status' => 'ok', 'message' => 'The following beers are in the user\'s recommendation profile', 'profile' => ['srm' => $srm, 'ibu' => $ibu, 'abv' => $abv], 'beers' => $beers]);
 }
 public function history()
 {
     $history = History::all();
     $customers = Customer::all();
     return view('admin.history', compact('history', 'customers'));
 }
Example #18
0
 public function getMonthCount($month)
 {
     return count(History::where('action', 'sms.send')->where('user_id', $this->id)->whereMonth('created_at', '=', $month)->get());
 }
Example #19
0
function hist($action, $content, $id)
{
    \App\History::create(['action' => $action, 'content' => $content, 'user_id' => $id]);
}
 public function validCommand()
 {
     $user_id = Auth::user()->id;
     $customer_id = Customer::where('user_id', '=', $user_id)->value('id');
     $token = session('_token');
     if (empty($customer_id)) {
         return view('front.form_customer');
     } else {
         $history = History::create(['customer_id' => $customer_id, 'token' => $token]);
         $history_id = $history->id;
         $carts = Cart::where('user_id', '=', $user_id)->get();
         foreach ($carts as $cart) {
             History_detail::create(['history_id' => $history_id, 'product_id' => $cart->product_id, 'quantity' => $cart->quantity]);
             $number_products_commanded = DB::table('customers')->where('id', '=', $customer_id)->value('number_products_commanded');
             $number_products_commanded += $cart->quantity;
             Customer::where('id', '=', $customer_id)->update(['number_products_commanded' => $number_products_commanded]);
             $cart->command_unf->delete();
             $cart->delete();
         }
         $total_price = 0;
         $history_details = History_detail::where('history_id', '=', $history_id)->get();
         foreach ($history_details as $history_detail) {
             $quantity = $history_detail->quantity;
             $price = $history_detail->product->price;
             $total_price += $quantity * $price;
         }
         DB::table('histories')->where('id', '=', $history_id)->update(['total_price' => $total_price]);
         return redirect('/')->with(['validcommand' => "Votre commande a bien été enregistrée ! Nous vous en remercions.", 'alert' => 'success']);
     }
 }
 public function showCurrentBasket()
 {
     $basket = History::where('id', 1)->with('user', 'historyproducts', 'products')->First();
     return view('basket', compact('basket', 'products'));
 }
 public function showHistoryAdmin()
 {
     $history = History::all()->sortByDesc('command_at');
     $totalcommand = History::TotalOrder();
     return view('admin.history', compact('history', 'totalcommand'));
 }
 public function detailOrder($id)
 {
     $lignesCommande = History::where('order_number', '=', $id)->get();
     return view('front.detailorder', compact('lignesCommande', 'id'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     if (Input::get('resume')) {
         $approveChecked = Input::get('resume');
         if (Auth::user()->type == 1 && Auth::user()->loginas == 1) {
             $records = EmployerApproval::select('pid')->whereIn('apid', $approveChecked)->selectRaw('count(`pid`) as `occurences`')->from('employerapproval')->groupBy('pid')->having('occurences', '>', 1)->get();
             if (count($records) != 0) {
                 Session::flash('message', 'You can not Approve more than one Employer for same Resume');
                 return Redirect::to('approval');
             } else {
                 foreach ($approveChecked as $approve) {
                     $rid = EmployerApproval::where('apid', $approve)->first();
                     $update = DB::table('personalinformation')->where('id', $rid->pid)->update(['approval_status' => 1, 'approved_by' => $rid->empid]);
                 }
                 $history = new History();
                 $history->action_id = Auth::user()->id;
                 $history->action = 'Resume Approved';
                 $history->user = Auth::user()->name;
                 $history->remark = 'Number of resume approved=' . count($approveChecked);
                 $history->save();
                 Session::flash('message', 'Resume Approved Successfully');
             }
         } else {
             foreach ($approveChecked as $approve) {
                 $prvcheck = EmployerApproval::wherePidAndEmpid($approve, Auth::user()->id)->first();
                 if ($prvcheck) {
                 } else {
                     $update = DB::table('personalinformation')->where('id', $approve)->update(['approved_by' => 1]);
                     $insert = new EmployerApproval();
                     $insert->pid = $approve;
                     $insert->empid = Auth::user()->id;
                     $insert->save();
                     Session::flash('message', 'Resume Requested Successfully');
                 }
             }
             if ($insert) {
                 $history = new History();
                 $history->action_id = Auth::user()->id;
                 $history->action = 'Resume Requested';
                 $history->user = Auth::user()->name;
                 $history->remark = 'Number of resume requested=' . count($approveChecked);
                 $history->save();
             }
         }
     }
     return Redirect::to('approval');
 }
 public function showHistory()
 {
     $histories = History::with('customer', 'product')->orderBy('command_at')->paginate(6);
     return view('admin.history', compact('histories'));
 }
Example #26
0
 public function indexHistory()
 {
     $sent = History::where('action', 'sms.send')->where('user_id', \Auth::user()->id)->orderBy('created_at', 'desc')->get();
     return view('sms.history')->withSent($sent);
 }
 public function history()
 {
     $historique = History::with('customer', 'product')->get();
     return view('admin.history', compact('historique'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $deletehistory = Input::get('list');
     if ($deletehistory) {
         foreach ($deletehistory as $delete) {
             $historydel = History::where('id', $delete)->delete();
         }
         Session::flash('message', 'Successfully deleted');
     } else {
     }
     return Redirect::to('history');
 }
 public function finalize(Request $request)
 {
     $panier = session('panier');
     $user = Auth::user();
     // user authentifié par le login
     $user_id = $user->id;
     //        dd($user_id);
     try {
         $customer = $user->customer()->firstOrFail();
         //            dd($customer);
         //        $customer = $data[0]; // $data est une collection !?
         if (!is_null($panier)) {
             foreach ($panier as $product_id => $quantity) {
                 $product = Product::find($product_id);
                 Event::fire(new ProductWasCommanded($product, $quantity));
                 $price = $product->price;
                 $quantities[] = $quantity;
                 History::create(['product_id' => $product_id, 'customer_id' => $customer->id, 'price' => $price, 'quantity' => $quantity, 'command_at' => Carbon::now(), 'status' => 'finalized']);
             }
             $number_command = array_sum($quantities);
             $customer->update(['number_command' => $number_command]);
             session(['panier' => NULL]);
             session(['stock' => NULL]);
             //            dd($panier);
             return redirect('/home')->with(['message' => 'succes add', 'alert' => 'Commande effectuée']);
             //            return view('front.cart', compact('products', 'quantities', 'total'));
         } else {
             return back()->with(['message' => 'Votre panier est vide']);
         }
     } catch (\Exception $e) {
         //            dd('mauvaise route');
         $request->session()->flash('status', 'fail');
         return back()->with(['message' => 'We need some information', 'alert' => 'fail']);
         //            dd('coucou'); // var_dump customisé + die
     }
 }
Example #30
0
 public function getLastDisposition()
 {
     return History::where('record_id', $this->id)->orderBy('created_at', 'DESC')->first();
 }