Exemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $save = $this->category->create(Input::all());
     //store the logs
     Audit::store('Settings', 'Added a new category with an id of ' . $save->id);
     return Redirect::to('/categories')->with(['flash_message' => 'Category has been saved.', 'flash_type' => 'alert-success', 'title' => 'Category list', 'categories' => $this->category->all()]);
 }
Exemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  * POST /employees
  *
  * @return Response
  */
 public function store()
 {
     //add new employee
     $employees = $this->employee->all();
     $save = $this->employee->create(Input::all());
     //store the logs
     Audit::store('Employees', 'Added a new employee with an id of ' . $save->id);
     return Redirect::route('employees.index')->with('employees', $employees)->with('title', 'Employees')->with('flash_message', 'Employee has been added')->with('flash_type', 'alert alert-success');
 }
Exemplo n.º 3
0
 /**
  * Store a newly created resource in storage.
  * POST /customers
  *
  * @return Response
  */
 public function store()
 {
     //save it
     $save = $this->customer->create(Input::all());
     //grab the customers data
     $customers = $this->customer->all();
     //store the logs
     Audit::store('Customers', 'Added new customer with an id of ' . $save->id);
     return Redirect::to('/customers')->with(['title' => 'Store Customers', 'customers' => $customers, 'flash_message' => 'Customer has been created.', 'flash_type' => 'alert-success']);
 }
Exemplo n.º 4
0
 /**
  * Manual restock of stocks.
  *
  * @return Response
  */
 public function restock()
 {
     $password = Input::get('admin_password');
     if (!Auth::attempt(array('password' => $password))) {
         return array('response' => 'Invalid password', 'status' => '500');
     }
     // return Input::all();
     $this->shipment->create(Input::all());
     $stock_id = Input::get('stock_id');
     // return $stock_id;
     $qty = Input::get('qty');
     // return $stock_id;
     //update the inventory
     $this->updateInventory($stock_id, $qty);
     //store the logs
     Audit::store('Inventory', 'Manual restock of ingredient with an id of ' . $stock_id);
     return Redirect::to('/inventory')->with(['flash_message' => 'Stock has been received successfully!', 'flash_type' => 'alert-success', 'ingredients' => $this->ingredient->all()]);
 }
Exemplo n.º 5
0
 /**
  * Logout the user.
  * DELETE /users/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy()
 {
     $user = Auth::user()->username;
     //destroy the session
     Auth::logout();
     //store the logs
     Audit::store('Authentication', 'Logged out.');
     Session::forget('log_access');
     return Redirect::to('auth/login')->with(['title' => 'Please login', 'flash_message' => 'You have been logged out.', 'flash_type' => 'alert-info']);
 }
Exemplo n.º 6
0
 /**
  * Update the specified resource in storage.
  * PUT /ingredients/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $ingredient = $this->stock->findOrFail($id);
     $ingredient->fill(Input::all());
     $ingredient->save();
     $ingredients = $this->stock->all();
     //store the logs
     Audit::store('Inventory', 'Edited ingredient details  with an id of ' . $id);
     return Redirect::to('/inventory/')->with(['title' => 'Store Inventory', 'ingredients' => $ingredients, 'flash_message' => 'Ingredient has been updated successfully.', 'flash_type' => 'alert-success']);
 }
Exemplo n.º 7
0
 /**
  * Purchasing process
  * 
  *
  * @return Response
  */
 public function purchase()
 {
     // return Input::all();
     //grab the item on the  temporary cart
     $temp_cart_items = $this->temp->all();
     $trans_id = Session::get('trans_id');
     $cust_id = Input::get('customer_id');
     $cashier = Input::get('cashier');
     $amount = Input::get('amount');
     $cash = Input::get('cash');
     $change = Input::get('change');
     $vat_amount = $amount * 0.12;
     // return $temp_cart_items[2]['item_id'];
     //save sold items
     $this->sale->saveSoldItems($temp_cart_items, $cust_id, $trans_id, $cashier, $amount, $cash, $change, $vat_amount);
     //update inventory
     $this->updateInventory($temp_cart_items);
     // store to the reports table
     // $this->report->saveReportData($temp_cart_items);
     //
     // //store the logs
     Audit::store('Sales', 'New purchase from a customer with an id of ' . $cust_id);
     TransactionLog::recordLog($trans_id, 'Sale completed.Invoice # ' . $trans_id, '', '', $cashier);
     //complete the sale
     return $this->completeSale();
 }