public function index(Request $request) { $start_time = $request->get('start') ? date("Y-m-d", strtotime($request->get('start') . " -1 day")) : date("Y-m-d", strtotime("-1 month -1 day")); $end_time = $request->get('end') ? date("Y-m-d", strtotime($request->get('end') . " +1 day")) : date("Y-m-d", strtotime("+1 day")); if (Auth::user()->role == "supadmin") { $company_id = $request->get('company_id'); } else { $company_id = $this->company_id[0]; } $currency = $company_id != null ? Company::find($company_id)->currency->title : null; if (Auth::user()->role == "supadmin") { $data = Payment::users($company_id, $start_time, $end_time); } else { $data = Payment::users($this->company_id[0], $start_time, $end_time); } return view('payment.list_users')->with(['data' => $data, 'currency' => $currency, 'companies' => Company::listAll()]); }
public function index(Request $request) { if (Auth::user()->role == "supadmin") { $company_id = $request->get('company_id'); } elseif (Auth::user()->role == "worker") { $company_id = implode(",", $this->company_id); } else { $company_id = $this->company_id[0]; } $start_shift = $end_shift = "00:00"; if ($company_id && Auth::user()->role != "worker") { $start_shift = Company::find($company_id)->shift_day_start; $end_shift = Company::find($company_id)->shift_night_start; } $companies = Company::listAll(); $workers = Company::workers($company_id); return view('rosters.list')->with(['company_id' => $company_id, 'shift_start' => $start_shift, 'shift_end' => $end_shift, 'workers' => $workers, 'companies' => $companies]); }
public function edit($id = null) { if ($id == null) { $id = Auth::user()->id; } $companies = Company::listAll(); $user = User::find($id); return view('users.edit')->with(['companies' => $companies, 'user' => $user]); }