public function getIndex()
 {
     // Retrieve all of the stored settings from the database.
     $api_key_id = Setting::where('key', 'api_key_id')->first();
     $api_key_verification_code = Setting::where('key', 'api_key_verification_code')->first();
     $api_key_character_id = Setting::where('key', 'api_key_character_id')->first();
     $home_region_id = Setting::where('key', 'home_region_id')->first();
     $home_region_name = Region::where('regionID', $home_region_id->value)->pluck('regionName');
     $shipping_cost = Setting::where('key', 'shipping_cost')->first();
     $characters = array();
     // If the API key is set, retrieve a list of characters.
     if ($api_key_id->value != '' && $api_key_verification_code->value != '') {
         $response = API::eveOnline('account/Characters');
         if ($response->body->result) {
             foreach ($response->body->result->rowset->row as $row) {
                 $characters[(string) $row['characterID']] = $row['name'];
             }
         }
     }
     // Retrieve the category filters.
     $filters = Filter::all();
     // Build a list of selected systems by looking up their IDs.
     $system_ids = Setting::where('key', 'systems')->pluck('value');
     $systems = System::whereIn('solarSystemID', explode(',', $system_ids))->get();
     // Do the same for selected alliances.
     $alliance_ids = Setting::where('key', 'alliances')->pluck('value');
     $alliances = Alliance::whereIn('id', explode(',', $alliance_ids))->get();
     // Load the template containing the form to update settings.
     return View::make('settings')->with('api_key_id', $api_key_id)->with('api_key_verification_code', $api_key_verification_code)->with('api_key_character_id', $api_key_character_id)->with('shipping_cost', $shipping_cost)->with('home_region_id', $home_region_id)->with('home_region_name', $home_region_name)->with('characters', $characters)->with('alliances', $alliances)->with('alliance_ids', $alliance_ids)->with('filters', $filters)->with('systems', $systems)->with('system_ids', $system_ids);
 }