public function all($params)
 {
     $params['order'] = isset($params['order']) ? $params['order'] : ['name|ASC'];
     $escalation_profiles = EscalationProfile::select("escalation_profiles.*");
     $escalation_profiles = parent::execute($escalation_profiles, $params);
     return $escalation_profiles;
 }
 public function edit($id)
 {
     if (Auth::user()->can('update-company')) {
         $data['company'] = Company::find($id);
         $selected_account_manager = CompanyAccountManager::where('company_id', '=', $id)->first();
         $data['company']->account_manager_id = isset($selected_account_manager) ? $selected_account_manager->account_manager_id : null;
         $selected_main_contact = CompanyMainContact::where('company_id', '=', $id)->first();
         $data['company']->main_contact_id = isset($selected_main_contact) ? $selected_main_contact->main_contact_id : null;
         $data['account_managers'] = CompanyPersonController::API()->all(["where" => ["company_person.company_id|=|" . ELETTRIC80_COMPANY_ID, "company_person.title_id|=|" . ACCOUNT_MANAGER_TITLE_ID], "order" => ["people.last_name|ASC", "people.first_name|ASC"], "paginate" => "false"]);
         $data['main_contacts'] = CompanyPerson::where('company_person.company_id', '=', $id)->get();
         $data['support_types'] = SupportType::orderBy("name")->get();
         $data['connection_types'] = ConnectionType::orderBy("name")->get();
         $data['escalation_profiles'] = EscalationProfile::orderBy("name")->get();
         $data['title'] = "Edit " . $data['company']->name;
         return view('companies/edit', $data);
     } else {
         return redirect()->back()->withErrors(['Access denied to companies edit page']);
     }
 }
 public function store(CreateEscalationProfileRequest $request)
 {
     $escalation_profile = new EscalationProfile();
     $escalation_profile->name = $request->name;
     $escalation_profile->description = $request->description;
     $escalation_profile->save();
     return redirect()->route('escalation_profiles.index')->with('successes', ['Esclation Profile created successfully']);
 }