/** * Display a listing of the resource. * * @return Response */ public function index() { if (Session::get('level') == '1' && Session::get('fingerprint') == md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR'])) { $data = Company::all(); return View::make('company.index', array('data' => $data)); } else { return Redirect::to('/'); } }
public function create($id, $tech_number = 1) { if (Auth::user()->can('create-service')) { $data['title'] = $tech_number == 1 ? "Create Service ~ " . $tech_number . " technician" : "Create Service ~ " . $tech_number . " technicians"; $data['companies'] = Company::all(); $data['company_id'] = $id; $data['contacts'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . $id], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]); $data['technicians'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . ELETTRIC80_COMPANY_ID], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]); $data['divisions'] = Division::orderBy("name")->get(); $data['hotels'] = Hotel::where('company_id', $id)->orderBy("name")->get(); $tech_number = $tech_number < 1 ? 1 : $tech_number; $tech_number = $tech_number > 5 ? 5 : $tech_number; $data['technician_number'] = $tech_number; foreach ($data['hotels'] as &$hotel) { $hotel['name_address'] = $hotel['name'] . " @ " . $hotel['address']; } return view('services/create', $data); } else { return redirect()->back()->withErrors(['Access denied to service create page']); } }
public function EditView($id) { if (!is_null($id)) { if (Auth::check()) { if (in_array('ADD_EDIT_USER', $this->permission)) { $user_obj = User::with('getCompany')->find($id); if (User::isSuperAdmin()) { $company_obj = Company::all(); $role_obj = Role::get(); } else { $company_obj = User::with('getCompany')->find(Auth::user()->id); $role_obj = Role::where('id', '>', 1)->get(); } return view('user.edit')->with('user_obj', $user_obj)->with('company_obj', $company_obj)->with('role_obj', $role_obj); } return \Redirect::back()->withErrors(['success' => false, 'msg' => 'You don\'t have permission']); } return Redirect::to(url('user/login')); } return \Redirect::back()->withErrors(['success' => false, 'msg' => 'somethings went wrongs']); }
/** * Returns view to display listing of companies. * * @author [Abdullah Alansari] [<*****@*****.**>] * @since [v1.8] * @return View */ public function getIndex() { return View::make('companies/index')->with('companies', Company::all()); }