public function addLocation() { //create a new location here $validator = Validator::make(Input::all(), LocationsForPm::$rules); if ($validator->passes()) { LocationsForPm::create(array('location' => Request::get('location'), 'numberOfHouses' => Request::get('number_of_houses'))); return Redirect::to('/pm')->with('message', 'Location Added Succsfully'); } else { return Redirect::to('/pm')->with('message', 'Something Went Wrong. Location was not added!'); } }
public function pm() { //return the pm view return view('pmDashboard', array('title' => 'PM | Welcome', 'reports' => \App\PmReport::all(), 'locations' => \App\LocationsForPm::all())); }
public static function getNumberOfHouses($loc) { $location = LocationsForPm::where('location', 'like', $loc)->first(); $number = $location->numberOfHouses; return $number; }